By Navjot Singh
I upgraded my Nginx 1.4.6 to 1.6.2 using this guide.
I am running Ubuntu 14.04 and 2 WordPress based sites.
This is my sample config file for wp site:
server {
listen 80;
root /var/www/nspeaks;
index index.php index.html index.htm;
server_name nspeaks.com wwww.nspeaks.com;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
include /etc/nginx/wordpress_params.regular;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
The wordpress_params.regular file has this
# WordPress pretty URLs:
if (-f $request_filename) {
break;
}
if (-d $request_filename) {
break;
}
rewrite ^(.+)$ /index.php?q=$1 last;
I am not sure what other changes were required. Please help.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Fixed it myself. Replaced
include fastcgi_params;
with
include fastcgi.conf;
And restarted nginx. All’s well now.
Also noticed that HTML files are being served just fine. Its the PHP files that are shown up as blanks.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.