Extra Form
PHP PHP 8.0
CMS WordPress

해결책을 알려주시는분꼐 커피한잔 쏘겠스빈다 ㅜㅜㅜㅜㅜㅜㅜㅜ

 

rocky linux + php8 + nginx + 워드프레스 입니다.

 

블로그 전체 레이아웃은 뜹니다.

포스팅(글)이 나와야할 부분이 404 Sorry, The Page Not Found 이렇게 나오네요.

 

DNS변경되는 1~2시간동안 똥줄탔습니다.(왜케오래거릴죠 ㅠㅠ)

 

초보의 의심)

1. 기존 호스팅 사이트에서 워드프레스 폴더가 html/public_html/ 이었는데 이번에 VPS로 옮기면서 /var/www/html/wordpres 로 바뀌어서 spl이 꼬였거나 하는 문제가 생긴걸까요? (폴더가 상관이있나요? ㅜㅜ)

2. ping을 던져보면 계속 그전 호스팅 주소가 나옵니다. 그런데 404뜨는 페이지의 ssl정보를 보면 새로 옮긴곳의 것이 뜹니다. 도대체 무슨일일까요

 

혹시 conf 파일에 문제가있나 싶어

제 도메인명만 도메인.com 으로 임의 변경해서 올립니다.

etc/nginx/nginx.conf 파일 입니다.

-------------------------------------

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  ‘$remote_addr - $remote_user [$time_local] “$request” ‘
                      ‘$status $body_bytes_sent “$http_referer” ‘
                      ‘”$http_user_agent” “$http_x_forwarded_for”’;

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

server {
server_name www.도메인.com 도메인.com;
root /var/www/html/wordpress;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* /wp-sitemap.*\.xml {
try_files $uri $uri/ /index.php$is_args$args;
}


client_max_body_size 100M;
# Pass the php scripts to FastCGI server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /app.php$is_args$args;
fastcgi_intercept_errors on;
}
gzip on;
gzip_comp_level 6;
gzip_min_length 1000;
gzip_proxied any;
gzip_disable “msie6”;
gzip_types
application/atom+xml
application/geo+json
application/javascript
application/x-javascript
application/json
application/ld+json
application/manifest+json
application/rdf+xml
application/rss+xml
application/xhtml+xml
application/xml
font/eot
font/otf
font/ttf
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
# assets, media
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
expires    90d;
access_log off;
}
# svg, fonts
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
add_header Access-Control-Allow-Origin “*”;
expires    90d;
access_log off;
}
location ~ /\.ht {
access_log off;
log_not_found off;
deny all;
}

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/도메인.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/도메인.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


    add_header Strict-Transport-Security “max-age=31536000” always; # managed by Certbot


    ssl_trusted_certificate /etc/letsencrypt/live/도메인.com/chain.pem; # managed by Certbot
    ssl_stapling on; # managed by Certbot
    ssl_stapling_verify on; # managed by Certbot

}

server {
    if ($host = 도메인.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


listen 80;
listen [::]:80;
server_name www.도메인.com 도메인.com;
root /var/www/html/wordpress;
index index.php index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* /wp-sitemap.*\.xml {
try_files $uri $uri/ /index.php$is_args$args;
}


client_max_body_size 100M;
# Pass the php scripts to FastCGI server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /app.php$is_args$args;
fastcgi_intercept_errors on;
}
gzip on;
gzip_comp_level 6;
gzip_min_length 1000;
gzip_proxied any;
gzip_disable “msie6”;
gzip_types
application/atom+xml
application/geo+json
application/javascript
application/x-javascript
application/json
application/ld+json
application/manifest+json
application/rdf+xml
application/rss+xml
application/xhtml+xml
application/xml
font/eot
font/otf
font/ttf
image/svg+xml
text/css
text/javascript
text/plain
text/xml;
# assets, media
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
expires    90d;
access_log off;
}
# svg, fonts
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
add_header Access-Control-Allow-Origin “*”;
expires    90d;
access_log off;
}
location ~ /\.ht {
access_log off;
log_not_found off;
deny all;
}


}}

 

  • profile

    server { } 를 떼서 다른 파일로 만들어 include 하면 어떨까요? 물론 꼭 그래야 한다는 법은 없습니다. PC 바탕화면에 프로그램이며 문서며 모두 깔아서 아이콘 수백개 만들어놓는 분도 있기는 한것처럼요 . 

    먼저 nginx라는 user와 그룹이 있는지부터 체크해보시구요. 퍼미션이 제대로 되어 있는지 봐야겠죠. 캐시폴더에 nginx의 write 퍼미션 있어야죠. 

  • profile profile
    그룹과 유저도 있고 chown -Rf nginx:nginx /usr/share/nginx/html 그리고 chown -Rf nginx:nginx /var/www/html/wordpress 이것도 해놓은 상태입니당 ㅜㅜ
  • profile

    404 오류를 뿜는 것이 nginx인가요 워드프레스인가요? nginx에서 뿜는 오류라면 Sorry, the page 어쩌고 하는 예의바른 메시지는 나오지 않습니다. 따라서 워드프레스에서 뿜는 오류일 가능성이 더 높은데요. 그렇다면 nginx에서 워드프레스로 요청을 전달해 주는 과정은 이미 잘 설정되어 있다고 봐도 무방합니다. 올려주신 장문의 설정을 대충 둘러봐도 워드프레스가 요구하는 try_files 구문은 잘 들어가 있는 것 같고요.

     

    P.S. 소스를 복붙할 때 들여쓰기가 다 날아가는 경우가 있습니다. 이러면 읽기가 무척 힘듭니다.

  • profile profile
    싹 날리고 다시 한번 해봐야겠습니다 ㅜㅜ