nodebook/Miscellaneous/nginx.conf
2019-11-26 13:15:05 +08:00

120 lines
2.9 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

server {
listen 80;
server_name powerrain.cn localhost;
location / {
root /data/wwwroot;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/wwwroot;
}
}
server {
#SSL 访问端口号为 443
listen 443 ssl http2; #填写绑定证书的域名
server_name powerrain.cn;
#证书文件名称
ssl_certificate 1_powerrain.cn_bundle.crt;
#私钥文件名称
ssl_certificate_key 2_powerrain.cn.key;
ssl_session_timeout 5m;
#请按照这个协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location / {
root /data/wwwroot;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/wwwroot;
}
}
server {
#SSL 访问端口号为 443
listen 443 ssl http2; #填写绑定证书的域名
server_name qr.powerrain.cn;
#证书文件名称
ssl_certificate 1_qr.powerrain.cn_bundle.crt;
#私钥文件名称
ssl_certificate_key 2_qr.powerrain.cn.key;
ssl_session_timeout 5m;
#请按照这个协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#请按照这个套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:5000;
}
}
server {
listen 80;
server_name yb.powerrain.cn;
location / {
root /data/yiban/yiban;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://127.0.0.1:8000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/wwwroot;
}
}
server {
#SSL 访问端口号为 443
listen 443 ssl http2; #填写绑定证书的域名
server_name yb.powerrain.cn;
#证书文件名称
ssl_certificate 1_yb.powerrain.cn_bundle.crt;
#私钥文件名称
ssl_certificate_key 2_yb.powerrain.cn.key;
ssl_session_timeout 5m;
#请按照这个协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location / {
root /data/yiban/yiban;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://127.0.0.1:8000;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/wwwroot;
}
}
#开启gzip
gzip on;
#压缩阀值小于1k不压缩
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
#压缩级别
gzip_comp_level 5;
#压缩的文件类型
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png application/javascript;
gzip_vary off;
#IE6对Gzip不怎么友好禁止IE6进行压缩
gzip_disable "MSIE [1-6]\.";