工作中,由于需要把默认的8443端口号隐藏起来,需要修改nginx server段的配置

server {
                listen       80;
                listen       443 ssl;
                server_name  download.yichenxiu.com;
                if ( $scheme = "http" ) {
                         rewrite ^/(.*) https://download.yichenxiu.com/$1 break;
                  }

                server_name_in_redirect off;
                proxy_set_header Host $host:$server_port;
                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;
                location / {
                    proxy_pass https://download.yichenxiu.com:8443;
                }

                ssl_certificate_key /etc/nginx/conf/域名证书/download.yichenxiu.com/Nginx/download.yichenxiu.com.key;
                ssl_certificate /etc/nginx/conf/域名证书/download.yichenxiu.com/Nginx/download.yichenxiu.com.nginx.crt;
            }

Last modification:January 22nd, 2020 at 07:42 pm
如果觉得我的文章对你有用,请随意赞赏