Setting up Nginx Config: [emerg] no port in upstream

Events happening in the community are now at Drupal community events on www.drupal.org.
splitsplitsplit's picture

I'm trying to set-up Perusio's nginx configuration, I'm getting the following error on testing it:

nginx: [emerg] no port in upstream "www0" in /etc/nginx/php_fpm_status_vhost.conf:16
nginx: configuration file /etc/nginx/nginx.conf test failed

I couldn't see any other posts on it, so I was hoping someone could explain it to me. I presume it has something to do with PHP-FPM.

My config for PHP-FPM was lifted from Perusio's other config and left pretty much unedited. I'm using the TCP ports version.

I doubled checked the ports and I can see all three PHP-FPM pools.

Comments

That means

perusio's picture

that your php-fpm config is broken. What upstreams you have defined, i.e., how are you running php-fpm.

I'm pretty much just using

splitsplitsplit's picture

So I think I've found the problem. The upstream defines two pools:

  • phpcgi
  • phpcgi_backup

php_fpm_status_vhost.conf sets up status and ping for www0, www1 and phpcgi.

So I changed www0 to phpcgi, phpcgi to phpcgi_backup and commented out www1.

That's fixed the configuration issue, I can now start nginx, but I'm not sure php is still working.

I can load html and images but for php I'm getting File not found in small text in the browser. (Ping does return pong however).

I think it's something to do with fastcgi_param SCRIPT_FILENAME, I also thought I had this set-up correctly but apparently not.

fastcgi_drupal:
fastcgi_param SCRIPT_FILENAME $document_root/index.php;

fastcgi_params:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

PHP pools config: (I'm only running one site, so I put it into the root)

chroot = /srv/www/mysite/public
chdir = /

My site config (inside server block)
server {
    ....
    root /srv/www/mysite/public;
    index index.php;

    location ~ .php$ {
        try_files      $uri = 404;
        fastcgi_pass   phpcgi;
        include apps/drupal/fastcgi_drupal.conf;
    }
}

I found a blog about it, but I can't spot any of the problems.

Solved

splitsplitsplit's picture

I found the answer in this thread:

http://forum.nginx.org/read.php?2,230967,230967#msg-230967

Commenting out chroot solved the problem. I think it the server was navigating to

/srv/www/mysite/public, then php was going to /srv/www/mysite/public so I was getting:

/srv/www/mysite/public/srv/www/mysite/public

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: