Nginx配置备忘1

Nginx配置文件备忘
#开启nginx前确保80、443端口没被占用,sqlserver的report服务会占用80端口,需要停掉或者换成其他端口号
#nginx开启https,被代理的iis站点可以不开,外部访问显示还是https
#登录腾讯的DNSPOD在线申请SSL证书,发放的是个证书包。里面各种类型都有,阿里、网易也有类似服务
#不明白的时候看官方文档比什么都好使

worker_processes  1;
error_log  logs/error.log;
events {
worker_connections  1024;
}
 
http {
 
sendfile on;
keepalive_timeout  600s;
client_max_body_size 2000m;
send_timeout 6000s;
gzip on;
gzip_static on;
gzip_proxied any;
gzip_min_length 1024;
gzip_buffers 4 16k;
gzip_comp_level 3;
gzip_types text/htm text/plain text/css application/x-javascript application/xml;
gzip_vary on;
 
server {
listen 80;
server_name  XXXXX.com www.XXXXX.com;
 
location /{
}
 
}
 
 
server {
 
listen 443 ssl;
ssl on;
ssl_certificate     1_XXXXX.com_bundle.crt;
ssl_certificate_key 2_XXXXX.com.key;
 
ssl_session_timeout 5m; 
ssl_protocols TLSv1 TlSv1.1 TLSv1.2;
ssl_ciphers SM2-WITH-SMS4-SM3:ECDH:AESGCM:HIGH:MEDIUM:!RC4:!DH:!MD5:!aNULL:!eNULL; 
ssl_prefer_server_ciphers on;
server_name  XXXXX.com  www.XXXXX.com;
 
location /{
 proxy_pass http://www.XXXXX.com:81;
}
 
}
 
 
server {
listen 8080;
 
proxy_set_header  Host $host;
proxy_set_header  X-Real-IP $remote_addr;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
charset utf-8;
 
location /tplus/touch/ {
    root   html;
    index  index.html;
 
    try_files $uri  /tplus/touch/index.html;
}
 
 
access_log  logs/host.access.log main;
rewrite ^/(.*)/v2/dist/(.*)$ /$1/v2/dist/$2 break;
rewrite ^/(.*)/v2 /$1/v2/index.html break;
rewrite ^/([0-9a-zA-Z]+)/(.*)\.(gif|jpg|jpeg|png|css|js|ico|htm|html|xml|zip)$ /_html/$2.$3 last;
rewrite ^/favicon.ico /_html/favicon.ico last;
rewrite ^/([0-9a-zA-Z]+)$ /301.html last;
 
location ~ .*\.config {
return 404;
}
 
location /_html {
location ~ .*\.config
{
return 404;
}
alias ../../website;
#expires 30d;  
}
 
location /_lgs {
alias ../../appserver/logs;
}
 
rewrite ^/(.*)/ScriptResource.axd /html last;
 
rewrite ^/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)/$ /$1/tenant.html last;
rewrite ^/([0-9a-zA-Z]+)/([0-9a-zA-Z]+)$ /$1/tenant.html last;
include       *.conf;
 
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   ../nginx/html;
}
location = /301.html {
root   ../nginx/html;
}
}
}
 
posted @ 2022-03-15 21:27  wsh3166Sir  阅读(62)  评论(0编辑  收藏  举报