51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

nginx 443 标准配置

nginx 443 标准配置

server {
	listen 443 ssl;
	server_name test.baimeidashu.com;
        ssl_certificate /etc/nginx/ssl_key/test.baimeidashu.com/test.baimeidashu.com.pem; 
        ssl_certificate_key  /etc/nginx/ssl_key/test.baimeidashu.com/test.baimeidashu.com.key; 

         location / {
          proxy_pass http://192.168.1.209:31009;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_send_timeout 3600s;
          proxy_buffering off;
          proxy_read_timeout 3600s;
          proxy_connect_timeout 3600;
          }

        location /api {
            rewrite ^/api/(.*) /$1 break; 
            proxy_pass https://uat-cloudservice.baimeidashu.com;
            proxy_send_timeout 3600s;
            proxy_buffering off;
            proxy_read_timeout 3600s;
            proxy_connect_timeout 3600;
            client_max_body_size 3000m;       




}


       location ^~ /oss {
                rewrite ^/oss/(.*) /$1 break; #去掉路径/oss/
                # oss内网地址
    	proxy_pass https://kt-t.oss-accelerate.aliyuncs.com;
                # oss内网地址
                proxy_set_header Host kt-t.oss-accelerate.aliyuncs.com; 
    	proxy_set_header X-Forwarded-Proto $scheme;
          	proxy_set_header X-Forwarded-Host $host;
          	proxy_set_header X-Forwarded-Server $host;
          	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          	proxy_set_header X-Real-IP $remote_addr;
            proxy_http_version 1.1;
    	  	proxy_set_header Upgrade $http_upgrade;
    	  	proxy_set_header Connection "Upgrade";
      	    proxy_read_timeout 1d;
          	proxy_send_timeout 1d;
                # 此处配置是为了把阿里云oss的返回的Content-Disposition隐藏掉,否则图片或文件在浏览器中会下载,不会显示。
    	   # proxy_hide_header Content-Disposition;
       }

     access_log  /var/log/nginx/test.baimeidashu.com.log;
     error_log  /var/log/nginx/test.baimeidashu.com.error.log;

       error_page 502 503 /50x.html;
       location = /50x.html {
          root /usr/share/nginx/html;




}
}


server {
listen 80;
server_name test.baimeidashu.com;
if ($host != 'test.baimeidashu.com') {
return 403;
}
#return 302 https://$server_name$request_uri;


        rewrite ^/(.*)$ https://$server_name:443/$1 permanent;



`}              `

赞(6)
未经允许不得转载:工具盒子 » nginx 443 标准配置