Primarily static site with Wordpress installed in a /blog/ subdirectory

I used the ee site create howtocookmeat.com --wpfc to create a site, then I moved the default Wordpress install into a /blog/ subdirectory. I modified the wp-config to reflect the changes, and everything seems to be working fine, except I’m throwing a 404 whenever I try to click on single posts, archives, etc. /blog/wp-admin is perfectly accessible, which is odd.

Ideas?

You need to add nginx rules

vim /etc/nginx/sites-available/howtocookmeat.com location /blog { try_files $uri $uri/ /blog/index.php?$args; }

Now let's test the nginx configuration and restart the nginx service nginx -t service nginx restart

Let's clear the nginx fastcgi cache rm -rf /var/run/nginx-cache/*

1 Like

Brilliant! It works. Thank you.

By the way, I wanted to thank you guys for all of the work you've put into this script and NGINX/Wordpress in general. You're a boon for the industry. Please, email me directly with any opportunity to donate to you. You've been a tremendous help with my business.

Thanks for your feedback and support.

You can use this link for the donation or just pay directly [email protected] via paypal. :)

I’m trying to do exactly the same thing. If I execute the command I get an error syntax error near unexpected token `}’. This topic is so old something might have changed. I did exactly the same thing as the original poster, I want a static site on my home directory and wordpress in blog. This is my current nginx config.
server {

server_name ryansmithphotography.com   www.ryansmithphotography.com;


access_log /var/log/nginx/ryansmithphotography.com.access.log rt_cache;
error_log /var/log/nginx/ryansmithphotography.com.error.log;
root /var/www/ryansmithphotography.com/htdocs;



index index.html index.php index.htm;


include  common/wpsc.conf;

include common/wpcommon.conf;
include common/locations.conf;

} Thanks for the help.

Hi @samoya22

It’s been a long time, and we haven’t heard from you. It looks like your issue is resolved.

I am closing this support topic for now. Feel free to create a new support topic if you have any queries further. :slight_smile: