3

I built a custom PHP/MySQL website (www.mywebsite.com) to which I attached a wordpress blog (www.mywebsite.com/blog). I've been trying so many different nginx config things and read so many blog articles that I'm lost now :-)

The main website part is working fine. All my url rewrites work fine. But on the blog part, I don't know what to do anymore for Wordpress to work properly.

Here's my last conf for the blog part. Permalinks work but the css and js files cannot be found.

location /blog {
  root /var/www/mywebsite.com/blog/;
  index index.php index.html index.htm;

  try_files $uri $uri/ /blog/index.php;
}

2 Answers 2

1

You can add a location for them, and a expires as well.

location ~* \.(js|css|xml|txt)$ {
  expires 14d;
  root /to/the/folder/they/live/in;
  access_log off;
}
Sign up to request clarification or add additional context in comments.

Comments

0

Discovered an awesome blog that I definitely recommend => http://blog.martinfjordvald.com/

After a read through, I updated the root in my location block like this:

    location /blog {
      root /var/www/mywebsite.com;
      index index.php index.html index.htm;    
      try_files $uri $uri/ /blog/index.php;
}

Works fine now !

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.