• nginx 配置


    1.解决依赖关系
    yum install gcc patch libffi-devel python-devel  zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel openssl openssl-devel -y
    2.下载源码包
    wget -c https://nginx.org/download/nginx-1.12.0.tar.gz
    3.解压缩源码包
    tar -zxvf nginx-1.12.0
    4.在当前路径下通过configure这个脚本文件执行,释放makefile,然后指定安装nginx的路径,以及开启模块功能ssl与状态模块功能
    ./configure --prefix=/opt/nginx1-12/ --with-http_ssl_module --with-http_stub_status_module
    5.编译且编译安装
    make && make install
    6.在/opt/nginx1-12/ 安装好nginx的目录,找到一个sbin的文件夹,找到nginx的启动命令,然后启动nginx服务
     1.检查nginx安装后的目录,ll /opt/nginx1-12
      drwxr-xr-x 2 root root 333 12月  6 09:32 conf  配置文件存放的目录,  nginx.conf这个文件就是nginx的主配置文件
      drwxr-xr-x 2 root root  40 12月  6 09:32 html   存放网页根目录的文件夹,存放了index.html   **.html  **.gif **.jpg
      drwxr-xr-x 2 root root   6 12月  6 09:32 logs   日志目录
      drwxr-xr-x 2 root root  19 12月  6 09:32 sbin   nginx启动脚本目录

    7.更改nginx.conf

    1. listen 80;
    2.  
      #定义使用www.xx.com访问
    3.  
      server_name www.app.com; # 或直接使用地址(118.89.235.150)
    4.  
      client_max_body_size 10M;
    5.  
    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
        proxy_pass http://localhost:5000/;
        proxy_redirect off;
    
        proxy_set_header Host $http_post;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

     8.

    ./sbin/nginx  #直接启动nginx
    ./sbin/nginx  -s  restart #重启nginx
    ./sbin/nginx -s stop
    ./sbin/nginx -s reload  #平滑重启(修改了nginx配置文件,不重启服务就加载配置且生效)
    ../sbin/nginx -t  检测nginx.conf 配置文件的语法正确性
     

  • 相关阅读:
    SqLite 框架 GreenDAO
    HttpClient的使用
    android事件分发介绍
    Android常见开发思路
    AndroidStudio学习记录
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo异常总结
    开源Pull_To_Refresh控件使用
    自定义控件ViewPagae<
    白龙软件商店面试问题整理
    基于anyrtc的sdk实现直播连麦互动
  • 原文地址:https://www.cnblogs.com/xdlzs/p/13523858.html
Copyright © 2020-2023  润新知