I'm using Ubuntu 14.10, nginx 1.6.2, php 5.5.12. I have a site set up like this:
server {
root /usr/share/nginx/www/oliviataussig;
index index.php;
server_name oliviataussig.com www.oliviataussig.com;
location / {
try_files $uri $uri/ /index.php =404;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
When I go to the homepage (index.php), it works fine. However, when I click on any of the links on the page (this is a WordPress-like CMS) I want to fall back to /index.php
, and it does that, but index.php
gets downloaded instead of executed. How do I fix that?
As Hrvoje suggested, Wordpres ->Nginx codex gives examples on most of possible situations (http://codex.wordpress.org/Nginx)
In your case, the config file should look like below:
It's necessary to CLEAR THE CACHE of your browser to see results with the next line.