server
{
listen 80;
listen 802;
server_name test111.xxxx.com 118.24.122.101;
gzip on;
gzip_min_length 10k; # 设置允许压缩的页面最小字节数
gzip_comp_level 6;
gzip_vary on;
gzip_types text/plain text/css application/javascript application/json application/xml text/xml image/png image/gif image/jpeg;
location / {
proxy_pass http://127.0.0.1:82;
root html;
index index.html index.htm default.aspx;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
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_connect_timeout 600;
proxy_read_timeout 600;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
https配置
server {
listen 443;
server_name test111.xxxx.com;
ssl on;
ssl_certificate cert/2937585_test111.xxxx.com.pem;
ssl_certificate_key cert/2937585_test111.xxxx.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
gzip on;
gzip_min_length 10k; # 设置允许压缩的页面最小字节数
gzip_comp_level 6;
gzip_vary on;
gzip_types text/plain text/css application/javascript application/json application/xml text/xml image/png image/gif image/jpeg;
location / {
proxy_pass http://127.0.0.1:8800;
root html;
index index.html index.htm;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
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_connect_timeout 600;
proxy_read_timeout 600;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server{
listen 80;
server_name test111.xxxx.com;
rewrite ^(.*)$ https://${server_name}$1 permanent;
}