zhangqiang 发表于 2018-2-3 16:47:32

Nginx 反向代理配置文件

server
   {
            listen             443;        #开启SSL模式
          listen                80;        #
            server_name    www.wsisp.com wsisp.com;        #绑定的域名
        ssl                  on;
            ssl_certificate      /home/wwwroot/www.wsisp.com/wsisp_com_chained.crt;                #SSL证书所在路径
            ssl_certificate_key/home/wwwroot/www.wsisp.com/wsisp_com.key;                        #SSL证书密钥所在路径

           ssl_session_timeout5m;        #SSL缓存超时时间

            ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;        #SSL支持的加密方式
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;                #SSL协议版本
            ssl_prefer_server_ciphers on;
            charset GB2312;                #网站编码
            index index.html index.htm        index.php;        #默认首页排列
            root    /home/wwwroot/www.wsisp.com/;        #网站存放路径
                if ($server_port = 80 ) {                #当请求的网站是http80端口,则跳转到https443端口
                return 301 https://$host$request_uri;
                }
                if ($host != 'www.wsisp.com')                #当请求的网页不是www.wsisp.com,则自动重定向到www.wsisp.com
                { rewrite ^/(.*)$ http://www.wsisp.com/$1 permanent;
                }

                location ~ ^/NginxStatus/ {
                        stub_status on;
                        access_log off;
               }

         location / {
             root    /home/wwwroot/www.wsisp.com/;
             proxy_redirect off ;
             proxy_set_header Host $host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header REMOTE-HOST $remote_addr;
             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             client_max_body_size 50m;
             client_body_buffer_size 256k;
             proxy_connect_timeout 30;
             proxy_send_timeout 30;
             proxy_read_timeout 60;
             proxy_buffer_size 256k;
             proxy_buffers 4 256k;
             proxy_busy_buffers_size 256k;
             proxy_temp_file_write_size 256k;
             proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
             proxy_max_temp_file_size 128m;
             proxy_pass                http://www.wsisp.net/;                #反向代理的源站地址
            }
#        rewrite ^(.*)$https://$host$1 permanent;
        }

页: [1]
查看完整版本: Nginx 反向代理配置文件