zoukankan      html  css  js  c++  java
  • Centos7安装nginx并设置为HTTP代理服务器(*)


    # wget https://nginx.org/download/nginx-1.9.9.tar.gz # tar -zxvf nginx-1.9.9.tar.gz # cd nginx-1.9.9 # ./configure --prefix=/usr/nginx/nginx-1.9.9

    执行 make、make install

    测试:

    # ./sbin/nginx -t

    输出:

    nginx: the configuration file /usr/nginx/nginx-1.9.9/nginx.conf syntax is ok
    nginx: configuration file /usr/nginx/nginx-1.9.9/nginx.conf test is successful

     启动:

    # ./sbin/nginx -c /usr/nginx/nginx-1.9.9/nginx.conf

    报错一:

    checking for OS

    + Linux 3.10.0-514.16.1.el7.x86_64 x86_64
    checking for C compiler ... not found

    ./configure: error: C compiler cc is not found

    执行:

    # yum install gcc gcc-c++ kernel-devel

    报错二:

    cp: `conf/koi-win' and `/usr/local/nginx/conf/koi-win' are the same file  

    执行:

    # ./configure --prefix=/usr/nginx/nginx-1.9.9 --conf-path=/usr/nginx/nginx-1.9.9/nginx.conf

    至此,nginx安装完毕,配置正向HTTP代理:

    编辑 nginx.conf 文件:

     server {
        resolver 8.8.8.8;
        resolver_timeout 5s;
     
        listen 0.0.0.0:8088;
     
        location / {
            proxy_pass $scheme://$host$request_uri;
            proxy_set_header Host $http_host;
     
            proxy_buffers 256 4k;
            proxy_max_temp_file_size 0;
     
            proxy_connect_timeout 30;
     
            proxy_cache_valid 200 302 10m;
            proxy_cache_valid 301 1h;
            proxy_cache_valid any 1m;
        }

    重启nginx:

    # ./sbin/nginx -s reload

    测试:

    浏览器配置HTTP代理,配置完成:

     

  • 相关阅读:
    vc6.0执行程序正确而debug版和release版运行错误
    visio调整画布大小和旋转画布
    Safecracker(暴力)
    gets()
    MATLAB——axis
    截尾平均数及利用SPSS求截尾平均数
    MATLAB求实数绝对值——abs
    MATLAB描绘饼图——pie
    error: expected unqualifiedid before 'int'
    MATLAB描绘极坐标图像——polar
  • 原文地址:https://www.cnblogs.com/javapath/p/6802792.html
Copyright © 2011-2022 走看看