I hope in the ".xxx.net" site, if the domain name is a specific "a.xxx.net", it will return 404 with my custom 404 page(error_page conf). But according to the following configuration, what I see is nginx's own 404 page (404 Not Found - nginx). Is there a problem with the configuration, or is it not supported? thx
server
{
listen 0.0.0.0:443 ssl;
listen [xxx::xxxx]:443 ssl;
http2 on;
server_name .xxx.net;
server_name_in_redirect on;
access_log xxx.log main;
error_log xxx.error.log;
root /home/xxx;
index index.php index.html index.htm;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header Cache-Control no-cache;
add_header X-XSS-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload" always;
proxy_hide_header Vary;
proxy_hide_header X-Powered-By;
proxy_hide_header X-Runtime;
proxy_hide_header X-Version;
proxy_hide_header X-AspNet-Version;
proxy_cookie_flags ~ secure httponly samesite=strict;
ssl_certificate xxx.cer;
ssl_certificate_key xxx.key;
ssl_dhparam ./vhosts/dhparams.4096.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 1d;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate xxx.pem;
error_page 404 /404.php;
set $flag '';
if ($host != 'aaa.xxx.net') {
set $flag 'A';
}
if ($request_uri ~ ^/xxxxx/(.*)$) {
set $flag "${flag}B";
}
if ($flag = 'AB') {
return 404; # not ok, show orginal nginx 404 page
}
location /xxx/ {
return 404; # ok, show my /404.php
}
location /xxx/ {
xxx
}
}
Edited 1 time(s). Last edit at 09/26/2024 10:37PM by JavaSCU.