上一篇文章的配置可以用来通用地部署 php 测试站点,但是有的时候部分应用程序只是暴露在本地端口,以下贴出反代版配置。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| 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;
}
|