Synology NAS wordpress with dockerize webstation and set permalink on nginx

  1. If use apache as your wordpress backend, you are able to configure .htaccess to do the rewrite rule, so you don't need to follow this article.
  2. Find your nginx service config on your NAS.
    # grep <domain> -Rnw /etc/nginx/conf.d/
    /etc/nginx/conf.d/.service.d23a4a4b-b695-47b7-ac51-fc7771ebe46a.7f6bfe2e-3039-4574-bb11-0a2105d40070.conf:3
  3. open the config and find the last line with xxxxxx/user.conf*
    # tail /etc/nginx/conf.d/.service.d23a4a4b-b695-47b7-ac51-fc7771ebe46a.7f6bfe2e-3039-4574-bb11-0a2105d40070.conf

    For example on my NAS, I found the line of target folder we mainly wanted.

    include /usr/local/etc/nginx/conf.d/7f6bfe2e-3039-4574-bb11-0a2105d40070/user.conf*;
  4. The nginx config generated by WebStation will be auto regenerated in every reboot. So it's neccessary to put your customized nginx config inside this folder, which will NEVER be removed during reboot.
    mkdir  /usr/local/etc/nginx/conf.d/7f6bfe2e-3039-4574-bb11-0a2105d40070/
  5. Create the user.conf inside the folder
    /usr/local/etc/nginx/conf.d/7f6bfe2e-3039-4574-bb11-0a2105d40070/user.conf
  6. Paste these lines into user.conf to do the rewrite rule for wordpress permalink
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
  7. Reload your nginx to make the changes work
    nginx -t
    systemctl reload nginx
  8. Everything works, enjoy it!
Subscribe
Notify of

0 Comments
Inline Feedbacks
View all comments