WordPress permalinks for NGINX in sub-folders

Re use rules with snippets

For all my sites, since they're on the root of the domain. Such as ricard.blog we need the following rule.

I've created a snippet to be shared amonst the different virtual hosts, so I don't have to write it over and over. I now just need to include the snippet.

location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; }

Now for the actual config file, I just include the snippet plus the custom location for my sub-blog, my podcast which lives under /podcast/

server { # Permalinks include /etc/nginx/snippets/wordpress.conf; # Podcast permalinks location /podcast/ { index index.php index.html index.htm; try_files $uri $uri/ /podcast/index.php?$args; } }

Note: the server block above does not contain all the necessary information to work, I've just written the relevant code for the Permalinks (it's missing the SSL certificates, the root folder, the server_name...

Leave a Reply

Add <code> Some Code </code> by using this tags.