Synology에서 WordPress 고유주소 & SuperCache 사용하기

Synology NAS에서 nginx를 사용하여 WordPress를 통해
permalink(고유주소)를 사용한다던지, SuperCache 플러그인을 사용하는 경우에!
몇가지의 파일들을 작성해 작성한 파일들을
가상호스트를 생성해 nginx설정에 include시켜주는 별도의 폴더안에 넣어줘야 합니다.

그 파일들의 코드를 공유하고자 합니다. (이 코드들은 반드시 인코딩 ANSI로 작성해야 작동합니다.)

user.conf.cache_expire

location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    expires 30d;
    add_header Pragma public;
    add_header Cache-Control "public";
}

user.conf.gzip

gzip on;
gzip_disable "msie6";

gzip_static on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 9;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types
    text/plain
    text/css
    text/js
    text/xml
    text/javascript
    application/javascript
    application/x-javascript
    application/json
    application/xml
    application/rss+xml
    image/svg+xml;

user.conf.restriction

location = /favicon.ico {
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}

location ~ /\. {
    deny all;
}

location ~* /(?:uploads|files)/.*\.php$ {
    deny all;
}

user.conf.supercache

set $cache_uri $request_uri;

if ($request_method = POST) {
    set $cache_uri 'null cache';
}

if ($query_string != "") {
    set $cache_uri 'null cache';
}

if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
    set $cache_uri 'null cache';
}

if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
    set $cache_uri 'null cache';
}

location / {
    try_files /wp-content/cache/supercache/$http_host/$cache_uri/index-https.html $uri $uri/ /index.php?$args;
}

물론 직접 Synology의 nginx설정 파일을 직접 편집해서 위와같이 코드를 적지않아도 적용은 가능하나, 시놀로지를 재부팅하거나 업데이트를 적용할때 초기화가 됩니다.

따라서, 위 코드들을 복사해서 user.conf.원하는파일명 으로 만들어준뒤!

https://blog.beginms.com/307/
해당 글을 참조해서 user.conf.rewrite 대신 위의 파일들을 작성해 넣어주시면 되겠습니다.

출처 : https://www.alphafactory.co.kr/2017/08/04/install-wordpress-on-synology-nas-with-nginx-php-fpm-7-mariadb/

1 댓글

  1. 비긴 응답

    안녕하세요 비긴입니다
    구독과 좋아요 부탁드리고, 더 재미있는 글로 찾아뵙겠습니다!

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다