- OS: Ubuntu 18.04.5 LTS(자체 VPS 보유)
- 웹서버: Nginx/1.18.0
- MySQL: x86_64 기반 Linux용 mysql 버전 8.0.22(MySQL 커뮤니티 서버 - GPL)
- 워드프레스: 5.6
내가 변경할 때영구 링크WordPress의 옵션(스크린샷:/wp-admin/options-permalink.php)를 기본값(?p=123) 에게/%포스트이름%/(페이지의 마지막 옵션) 다음 오류가 발생합니다."ERR_TOO_MANY_REDIRECTS"상태 코드 포함301 홈페이지 전용 (그래서 직접 example.com), 다른 모든 페이지는 완벽하게 작동하며, 새로운 고유 링크 옵션도 다음을 통해 기본 블로그에 액세스할 수 있도록 제대로 작동합니다./안녕하세요-세계/곧장.
왜 그런지 아시나요? 이것은 내 서버가 완성되고 다른 모든 것보다 이 작은 버그에 더 많은 시간을 할애하는 마지막 작업이었습니다.참고: 서버 측 캐싱을 지우는 데 사용하는 nginx 캐시를 제외하고 모든 플러그인을 비활성화했습니다. 또한 시크릿 웹사이트를 방문합니다.
나는 이 튜토리얼을 따랐다:SpinUp WP(CH6까지 모든 작업을 수행했습니다). 이로써 내 NGINX 설정은 다음과 같습니다.
NGINX 구성 파일(개인정보 보호를 위해 사용자 이름을 omar로 변경했습니다.)
user omar;
worker_processes 6;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 1024;
multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
keepalive_timeout 15;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 64m;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Cache Settings
##
fastcgi_cache_key "$scheme$request_method$host$request_uri";
add_header Fastcgi-Cache $upstream_cache_status;
##
# Security
##
add_header Content-Security-Policy "default-src 'self' https: data: 'unsafe-inline' 'unsafe-eval';" always;
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "origin-when-cross-origin" always;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 444;
}
}
example.com의 구성 파일(개인정보 보호를 위해 사용자 이름을 omar로, 도메인을 example.com으로 변경했습니다):
fastcgi_cache_path /home/omar/example.com/cache levels=1:2 keys_zone=example.com:100m inactive=60m;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
access_log /home/omar/example.com/logs/access.log;
error_log /home/omar/example.com/logs/error.log;
root /home/omar/example.com/public/;
index index.php;
set $skip_cache 0;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache uris containing the following segments
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
set $skip_cache 1;
}
# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
if ($request_uri ~* "/(cart|checkout|my-account)/*$")
{
set $skip_cache 1;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache example.com;
fastcgi_cache_valid 60m;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.example.com;;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
return 301 https://example.com$request_uri;
}
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;;
return 301 https://example.com$request_uri;
}
보여드릴 것이 더 필요하면 말씀해 주시면 더 보여 드리겠습니다.
답변1
Alhamdulillah, 답을 찾았습니다. 그것은 모두 완벽주의 무슬림이 되기 위한 노력 때문이었습니다. 내부 URL에는 대문자가 있었습니다./wp-admin/options-general.php. 하나님(Alhamdulillah)에 대한 모든 찬양은 모든 문자를 소문자로 만들어 해결됩니다. 하나님의 뜻(샤아 알라)은 형제와 비형제 모두에게 도움이 될 것입니다.