nginx配置-通用的测试站点2-反代版

in Nginx with 0 comment

上一篇文章的配置可以用来通用地部署php测试站点,但是有的时候部分应用程序只是暴露在本地端口,以下贴出反代版配置。

server
   {
        listen 80;
        listen 443 ssl http2;
        server_name ~(.+)\.port\.example\.com$;
        index index.php index.html index.htm;
        set $port $1;

        ssl on;
        ssl_certificate /path/to/your.cer;
        ssl_certificate_key /path/to/your.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        location /
        {
            proxy_pass http://127.0.0.1:$port;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Scheme $scheme;
            
        }

        access_log  off;

   }
Responses