Setting up wordpress with NGINX fail..

So I am setting up my wordpress (migrating from localhost onto a test server, soon to be live) and I can’t seem to get this working. I am mirgrating from a apache localhost server to a nginx server. Everytime I try to reload the nginx settings, I get different errors like: nginx: [emerg] no port in upstream “php” in /etc/nginx/global/wordpress.conf:33

Here’s my config files for nginx. default

# Redirect everything to the main site. We use a separate server statement and NOT an if statement - see

server {
        server_name  _;
        rewrite ^ $scheme://****.com$request_uri redirect;
server {
	server_name ****.com;
	root /usr/share/nginx/html;

	index index.php;

	include global/restrictions.conf;

	# Additional rules go here.

	# Only include one of the files below.
	include global/wordpress.conf;
#	include global/wordpress-ms-subdir.conf;
#	include global/wordpress-ms-subdomain.conf;


# WordPress single site rules.
# Designed to be included in any server {} block.

# This order might seem weird - this is attempted to match last if rules below fail.
location / {
        try_files $uri $uri/ /index.php?$args;

# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;

# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
       access_log off; log_not_found off; expires max;

# Uncomment one of the lines below for the appropriate caching plugin (if used).
#include global/wordpress-wp-super-cache.conf;
#include global/wordpress-w3-total-cache.conf;

# Pass all .php files onto a php-fpm/php-fcgi server.
location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
                return 404;
        # This is a robust solution for path info security issue and works with "cgi.fix_pathinfo = 1" in /etc/php.ini (default)

        include fastcgi_params;
        fastcgi_index index.php;
#       fastcgi_intercept_errors on;
        fastcgi_pass php;


# Global restrictions configuration file.
# Designed to be included in any server {} block.</p>
location = /favicon.ico {
	log_not_found off;
	access_log off;

location = /robots.txt {
	allow all;
	log_not_found off;
	access_log off;

# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\. {
	deny all;

# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~* /(?:uploads|files)/.*\.php$ {
	deny all;

I have been trying to fix this for 2 hours, and no luck. This server has been configured to nginx, so switching over to apache is a difficult task for me.

Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

The error points out that you have a problem on line 33 of /etc/nginx/global/wordpress.conf

fastcgi_pass php;

Written like that, Nginx expects to find an “upstream” server block like:

upstream php {
    server unix:/run/php-fpm/php-fpm.sock;

That isn’t 100% necessary though. You could also just replace the line with:

fastcgi_pass unix:/var/run/php5-fpm.sock;

For more info, check out these tutorials: