800
server { if ($host = funcom.co.kr) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = www.funcom.co.kr) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; # server_name funcom.co.kr www.funcom.co.kr; return 301 https://$host$request_uri; } server { listen 443 ssl; ssl_certificate /etc/letsencrypt/live/funcom.co.kr/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/funcom.co.kr/privkey.pem; # managed by Certbot server_name funcom.co.kr www.funcom.co.kr; root /funcomwww/funcom.co.kr; index index.php index.html index.htm; try_files $uri $uri/ /index.php?q=$uri&$args; location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ { if ($http_accept !~* "image/webp") { break; } add_header Vary Accept; add_header Cache-Control "private" always; expires 365d; try_files /wp-content/uploads-webpc/$path.$ext.webp $uri =404; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_read_timeout 300; } location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { expires 1M; access_log off; add_header Cache-Control "public"; } location ~* \.(?:css|js)$ { expires 1y; access_log off; add_header Cache-Control "public"; } } server { # xmlrpc.php 막기 location = /xmlrpc.php { deny all; } }
잘되지만 문제있는 funcom.conf 백업
nginx를 사용하면 문제없이 작동은 한다..하지만 server 부분의 약간 잘못된 설정으로
nginx -t 로 테스트를 해보면 다음과 같은 무시되는 오류가 나온다..
nginx -t nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored
긴급복구용으로는 지금의 상태로 써도 무관하다.
참고로 워드프레스용이니 php script 에서는 필요없는 부분들을 지워줘야한다..😀