网硕互联技术交流社区

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1989|回复: 0

Nginx 反向代理配置文件

[复制链接]

主题

帖子

0

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
0
发表于 2018-2-3 16:47:32 | 显示全部楼层 |阅读模式
  1. server
  2.      {
  3.             listen             443;        #开启SSL模式
  4.             listen                80;        #
  5.             server_name    www.wsisp.com wsisp.com;        #绑定的域名
  6.         ssl                  on;
  7.             ssl_certificate      /home/wwwroot/www.wsisp.com/wsisp_com_chained.crt;                #SSL证书所在路径
  8.             ssl_certificate_key  /home/wwwroot/www.wsisp.com/wsisp_com.key;                        #SSL证书密钥所在路径

  9.            ssl_session_timeout  5m;        #SSL缓存超时时间

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

  22.                 location ~ ^/NginxStatus/ {
  23.                         stub_status on;
  24.                         access_log off;
  25.                  }

  26.          location / {
  27.              root    /home/wwwroot/www.wsisp.com/;
  28.              proxy_redirect off ;
  29.              proxy_set_header Host $host;
  30.              proxy_set_header X-Real-IP $remote_addr;
  31.              proxy_set_header REMOTE-HOST $remote_addr;
  32.              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  33.              client_max_body_size 50m;
  34.              client_body_buffer_size 256k;
  35.              proxy_connect_timeout 30;
  36.              proxy_send_timeout 30;
  37.              proxy_read_timeout 60;
  38.              proxy_buffer_size 256k;
  39.              proxy_buffers 4 256k;
  40.              proxy_busy_buffers_size 256k;
  41.              proxy_temp_file_write_size 256k;
  42.              proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
  43.              proxy_max_temp_file_size 128m;
  44.              proxy_pass                http://www.wsisp.net/;                #反向代理的源站地址
  45.             }
  46. #        rewrite ^(.*)$  https://$host$1 permanent;
  47.         }
复制代码

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|网硕互联技术交流社区

GMT+8, 2024-4-26 21:37 , Processed in 0.237775 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表