- 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. - 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
- 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*;
- 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/
- Create the user.conf inside the folder
/usr/local/etc/nginx/conf.d/7f6bfe2e-3039-4574-bb11-0a2105d40070/user.conf
- Paste these lines into
user.conf
to do the rewrite rule for wordpress permalinklocation / { try_files $uri $uri/ /index.php?$args; }
- Reload your nginx to make the changes work
nginx -t systemctl reload nginx
- Everything works, enjoy it!
Subscribe
0 Comments