67 lines
1.9 KiB
Nginx Configuration File
67 lines
1.9 KiB
Nginx Configuration File
upstream backend {
|
||
server 127.0.0.1:3000;
|
||
server 47.106.106.179:4000 backup;
|
||
}
|
||
|
||
server {
|
||
listen 80;
|
||
server_name www1.wanzhuanyongcheng.cn;
|
||
index index.php index.html index.htm default.php default.htm default.html;
|
||
root /www/wwwroot/www1.wanzhuanyongcheng.cn;
|
||
|
||
#PHP-INFO-START PHP引用配置,可以注释或修改
|
||
include enable-php-00.conf;
|
||
#PHP-INFO-END
|
||
|
||
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
|
||
include /www/server/panel/vhost/rewrite/www1.wanzhuanyongcheng.cn.conf;
|
||
#REWRITE-END
|
||
|
||
#禁止访问的文件或目录
|
||
location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md) {
|
||
return 404;
|
||
}
|
||
|
||
#一键申请SSL证书验证目录相关设置
|
||
location ~ \.well-known {
|
||
allow all;
|
||
}
|
||
|
||
#禁止在证书验证目录放入敏感文件
|
||
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
|
||
return 403;
|
||
}
|
||
|
||
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
|
||
expires 30d;
|
||
error_log /dev/null;
|
||
access_log /dev/null;
|
||
}
|
||
|
||
location ~ .*\.(js|css)?$ {
|
||
expires 12h;
|
||
error_log /dev/null;
|
||
access_log /dev/null;
|
||
}
|
||
|
||
location /api {
|
||
proxy_pass http://127.0.0.1:3000;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
||
error_page 502 = @switch_to_backup;
|
||
}
|
||
|
||
location @switch_to_backup {
|
||
proxy_pass http://47.106.106.179:4000;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
||
# Add any necessary additional configuration for backup container
|
||
}
|
||
|
||
access_log /www/wwwlogs/www1.wanzhuanyongcheng.cn.log;
|
||
error_log /www/wwwlogs/www1.wanzhuanyongcheng.cn.error.log;
|
||
} |