反向代理遇到问题
NoctuG opened this issue · 1 comments
NoctuG commented
环境: Debian + Docker
问题描述: 程序运行成功,可以通过 ip:8088
访问,但通过反向代理的域名访问,页面空白
配置文件
Nginx
server
{
listen 80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
listen [::]:80;
server_name domain.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/domain.com;
#SSL-START
#error_page 404/404.html;
#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
#HTTP_TO_HTTPS_END
#HTTP_TO_HTTPS_START
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
#HTTP_TO_HTTPS_END
ssl_certificate /www/server/web_conf/ssl/domain.com/fullchain.pem;
ssl_certificate_key /www/server/web_conf/ssl/domain.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
#SSL-END
#301-START
#PROXY-START
include /www/server/web_conf/nginx/proxy/domain.com/*.conf;
#PROXY-END
#ERROR-PAGE-START
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START
include /www/server/web_conf/php/conf/enable-php-00.conf;
#PHP-INFO-END
#REWRITE-START
include /www/server/web_conf/nginx/rewrite/domain.com.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
location ~ .*\\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
expires 30d;
error_log /dev/null;
access_log /dev/null;
}
access_log /www/wwwlogs/domain.com.log main;
error_log /www/wwwlogs/domain.com.error.log;
}
错误日志
2023/11/19 10:07:39 [error] 1928573#0: *89077 open() "/www/wwwroot/domain.com/password/resource.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /password/resource.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:39 [error] 1928573#0: *89078 open() "/www/wwwroot/domain.com/password/resource.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /password/resource.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:39 [error] 1928573#0: *89078 open() "/www/wwwroot/domain.com/pl/alior/alior-logo.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pl/alior/alior-logo.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:40 [error] 1928573#0: *89079 open() "/www/wwwroot/domain.com/pl/alior/alior-logo.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pl/alior/alior-logo.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:40 [error] 1928573#0: *89079 open() "/www/wwwroot/domain.com/bpegstar/pge/logo.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /bpegstar/pge/logo.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:40 [error] 1928573#0: *89080 open() "/www/wwwroot/domain.com/bpegstar/pge/logo.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /bpegstar/pge/logo.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:42 [error] 1928573#0: *89082 open() "/www/wwwroot/domain.com/pl/banks-logo/visa-master.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pl/banks-logo/visa-master.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:42 [error] 1928573#0: *89083 open() "/www/wwwroot/domain.com/pl/banks-logo/visa-master.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pl/banks-logo/visa-master.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:43 [error] 1928573#0: *89084 open() "/www/wwwroot/domain.com/pl/przelewy24/trnRequest/DB3D9963A9/data.php" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pl/przelewy24/trnRequest/DB3D9963A9/data.php HTTP/1.1", host: "domain.com"
2023/11/19 10:07:43 [error] 1928573#0: *89085 open() "/www/wwwroot/domain.com/pl/przelewy24/trnRequest/DB3D9963A9/data.php" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pl/przelewy24/trnRequest/DB3D9963A9/data.php HTTP/1.1", host: "domain.com"
2023/11/19 10:07:44 [error] 1928573#0: *89085 open() "/www/wwwroot/domain.com/meta/mm-logo.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /meta/mm-logo.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:44 [error] 1928573#0: *89086 open() "/www/wwwroot/domain.com/meta/mm-logo.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /meta/mm-logo.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:44 [error] 1928573#0: *89086 open() "/www/wwwroot/domain.com/files/eye.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /files/eye.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:45 [error] 1928573#0: *89087 open() "/www/wwwroot/domain.com/files/eye.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /files/eye.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:45 [error] 1928573#0: *89087 open() "/www/wwwroot/domain.com/pre-land/eye.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pre-land/eye.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:45 [error] 1928573#0: *89088 open() "/www/wwwroot/domain.com/pre-land/eye.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pre-land/eye.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:45 [error] 1928573#0: *89088 open() "/www/wwwroot/domain.com/front_end/front_end_files/logo-white.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /front_end/front_end_files/logo-white.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:46 [error] 1928573#0: *89089 open() "/www/wwwroot/domain.com/front_end/front_end_files/logo-white.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /front_end/front_end_files/logo-white.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:47 [error] 1928573#0: *89091 open() "/www/wwwroot/domain.com/shippinginfo.html" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /shippinginfo.html HTTP/1.1", host: "domain.com"
2023/11/19 10:07:48 [error] 1928573#0: *89092 open() "/www/wwwroot/domain.com/shippinginfo.html" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /shippinginfo.html HTTP/1.1", host: "domain.com"
2023/11/19 10:07:48 [error] 1928573#0: *89093 open() "/www/wwwroot/domain.com/.DS_Store" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /.DS_Store HTTP/1.1", host: "domain.com"
2023/11/19 10:07:49 [error] 1928573#0: *89094 open() "/www/wwwroot/domain.com/.DS_Store" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /.DS_Store HTTP/1.1", host: "domain.com"
2023/11/19 10:07:49 [error] 1928573#0: *89094 open() "/www/wwwroot/domain.com/202" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /202 HTTP/1.1", host: "domain.com"
2023/11/19 10:07:49 [error] 1928573#0: *89095 open() "/www/wwwroot/domain.com/202" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /202 HTTP/1.1", host: "domain.com"
2023/11/19 10:07:50 [error] 1928573#0: *89095 open() "/www/wwwroot/domain.com/image/loading/loading-spin.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /image/loading/loading-spin.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:50 [error] 1928573#0: *89096 open() "/www/wwwroot/domain.com/image/loading/loading-spin.svg" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /image/loading/loading-spin.svg HTTP/1.1", host: "domain.com"
2023/11/19 10:07:50 [error] 1928573#0: *89096 open() "/www/wwwroot/domain.com/app/Panel/botActBan/ip_ban.txt" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /app/Panel/botActBan/ip_ban.txt HTTP/1.1", host: "domain.com"
2023/11/19 10:07:51 [error] 1928573#0: *89097 open() "/www/wwwroot/domain.com/app/Panel/botActBan/ip_ban.txt" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /app/Panel/botActBan/ip_ban.txt HTTP/1.1", host: "domain.com"
2023/11/19 10:07:51 [error] 1928573#0: *89097 open() "/www/wwwroot/domain.com/pl/zabka/p32k2l13/start-transaction/index.php" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pl/zabka/p32k2l13/start-transaction/index.php HTTP/1.1", host: "domain.com"
2023/11/19 10:07:51 [error] 1928573#0: *89098 open() "/www/wwwroot/domain.com/pl/zabka/p32k2l13/start-transaction/index.php" failed (2: No such file or directory), client: 79.137.68.184, server: domain.com, request: "GET /pl/zabka/p32k2l13/start-transaction/index.php HTTP/1.1", host: "domain.com"
2023/11/19 10:14:19 [error] 1928761#0: *7 open() "/www/wwwroot/domain.com/favicon.ico" failed (2: No such file or directory), client: 36.61.198.26, server: domain.com, request: "GET /favicon.ico HTTP/2.0", host: "domain.com", referrer: "https://domain.com/"
2023/11/19 10:14:22 [error] 1928761#0: *7 open() "/www/wwwroot/domain.com/favicon.ico" failed (2: No such file or directory), client: 36.61.198.26, server: domain.com, request: "GET /favicon.ico HTTP/2.0", host: "domain.com", referrer: "https://domain.com/"
2023/11/19 10:20:07 [error] 1928761#0: *9 open() "/www/wwwroot/domain.com/app" failed (2: No such file or directory), client: 172.233.85.127, server: domain.com, request: "GET /app HTTP/2.0", host: "domain.com"
2023/11/19 10:22:48 [error] 1928761#0: *10 open() "/www/wwwroot/domain.com/favicon.ico" failed (2: No such file or directory), client: 5.164.29.116, server: domain.com, request: "GET /favicon.ico HTTP/1.1", host: "domain.com"
NoctuG commented
Nginx.conf 配置有误,进行如下修改后问题解决:
http {
# ... (other configurations)
proxy_cache_path /path/to/cache levels=1:2 keys_zone=mw_cache:10m max_size=10g inactive=60m use_temp_path=off;
# ... (other configurations)
server {
# ... (server block configurations)
location / {
proxy_cache mw_cache;
proxy_cache_valid 200 301 302 5m;
proxy_cache_valid 404 1m;
# ... (other proxy configurations)
}
}
}