
www.kasacja-aut.pl에서 kasacja-aut.pl로 301 리디렉션 양식을 만들고 싶었는데 이상한 일이 일어났습니다.
이제 내 웹사이트는 다음과 같이 자체적으로 리디렉션됩니다. https://kasacja-aut.pl/kasacja-aut.pl/kasacja-aut.pl/kasacja-aut.pl/kasacja-aut.pl/kasacja-aut.pl/...그리고 또!
server {
listen 80;
listen [::]:80;
server_name www.kasacja-aut.pl kasacja-aut.pl;
return 301 https://$kasacja-aut.pl$request_uri;
server {
listen 443 ssl http2;
server_name kasacja-aut.pl;
index index.html bialogard.html gdansk.html goleniow.html karlino.html kolobrzeg.html koszalin.html miedzyzdroje.html police.html stargard.html swinoujscie.html
szczecin.html szczecinek.html;
root /var/www/kasacja-aut.pl;
sendfile off;
access_log /var/log/nginx/auto-kasacja.pl/access.log;
error_log /var/log/nginx/auto-kasacja.pl/error.log;
client_body_timeout 5s;
client_header_timeout 5s;
#Bezpieczeństwo
add_header Strict-Transport-Security max-age=15768000;
#Zabezpiecz ciastka :]
proxy_cookie_domain ~(?P<secure_domain>([-0-9a-z]+\.)?[-0-9a-z]+\.[a-z]+)$ "$secure_domain; secure";
# Clickjacking security.
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
ssl_certificate_key /etc/ssl/auto-kasacja.pl/key.key;
ssl_certificate /etc/ssl/auto-kasacja.pl/cloudflare.crt;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_session_cache shared:SSL:30m;
ssl_session_timeout 30m;
keepalive_timeout 70;
# CLOUDFLARE RESTORE IP
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2c0f:f248::/32;
set_real_ip_from 2a06:98c0::/29;
# use any of the following two
real_ip_header CF-Connecting-IP;
#real_ip_header X-Forwarded-For;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location / {
root /var/www/kasacja-aut.pl;
error_page 500 502 503 504 404 = /index.html;
# Wywal boty z Layer-7 damm.
if ($http_user_agent ~* foo|bar) {
return 403;
}
proxy_cookie_path / "/; secure; HttpOnly";
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|woff2|ttf|otf|eot|woff)$ {
expires max;
log_not_found off;
}
}
답변1
수정할 수 있는 명백한 오타가 있습니다.
return 301 https://$kasacja-aut.pl$request_uri;
나는 그것이 무엇을 할 것인지 전혀 모르지만 아마도 좋지 않을 것입니다. 아마도 다음과 같은 것을 의미했을 것입니다.
return 301 https://kasacja-aut.pl$request_uri;
그러나 HSTS를 사용하려는 경우 먼저 HTTP에서 HTTPS로 동일한 호스트 이름으로 리디렉션한 다음 별도의 HTTPS server
블록에서 www를 www가 아닌 이름으로(또는 그 반대로) 리디렉션해야 합니다.
return 301 https://$host$request_uri;