Unable to get Wordpress Site running in nginx server

May 18, 2014 1.1k views
Hello, I have a 512 MB basic package droplet. I am running Ubuntu 14.04 and LEMP stack. I am trying to host multiple wordpress site in a single droplet. I have uploaded my wordpress files to " /var/www/domain.com/html" and configured the nginx block following this tutorial: https://www.digitalocean.com/community/articles/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-14-04-lts My /etc/nginx/sites-available/domain.com block looks like the following: server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /var/www/domain.com/html; index index.php index.html index.htm; server_name; location / { try_files $uri $uri/ =404; } } But when I try to access the site: , it gets "could not connect to" error. Any Suggestions.
2 Answers
WordPress requires a PHP pass through with nginx. You should look into configuring PHP5-FPM and then FastCGI with your vhost.
For all the details on setting up Wordpress on Nginx, check out:


The short version is like Rhys mentioned, you need to set up a PHP pass through. So your server block should look like:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /var/www/html;
index index.php index.php index.html index.htm;

server_name your_domain.com;

location / {
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?q=$uri&$args;

error_page 404 /404.html;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;

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;
by Justin Ellingwood
WordPress is the most popular CMS (content management system) in the world. It can be used to get your site or blog off the ground quickly and it provides a nice interface for adding content and modifying the site's design. In this guide, we'll walk through how to install WordPress on Ubuntu 14.04 with an Nginx web server.
Have another answer? Share your knowledge.