Update 2

I restarted the server and now all sites are resolving. I am assuming this must have been an error with PHP5-FPM after I killed Nginx without using the /etc/init.d/nginx -restart due to it failing.

Update:

The missing variable was located in one of my sub conf files, which I discovered after disabling them one at a time and scanning through the configuration.

My problem now however is that even though the config file now loads without errors my php site is showing 502 Bad Gateway when I try to access it.

PHP-FPM is running but the domain won't resolve:

server { listen 80; server_name blog.mysite.com;

   root            /home/ash/blog.mysite.com;

   index           index.php index.html;
   fastcgi_index   index.php;

   client_max_body_size 50M;

   if (!-e $request_filename) {
      rewrite ^.*$ /index.php last;
   }
   location ~ \.php {
          include /opt/nginx/conf/fastcgi_params;
          fastcgi_pass    127.0.0.1:9000;
          fastcgi_index   index.php;
          fastcgi_param SCRIPT_FILENAME /home/ash/blog.mysite.com$fastcgi_script_name;
    }
}

Problem (solved)

Before now I had all my sites stuffed into a single configuration file which was starting to become somewhat bloated.I was hoping to separate out sites giving each one a single conf file.

To do this I removed each site starting with site { until the end }, I then added the line include /opt/nginx/conf/sites-enabled/*.conf;

However when I try to reload I get the following error.

nginx: [emerg] invalid variable name in /opt/nginx/conf/nginx.conf:39

Here is the entire config file:

user  ash;
worker_processes 5;

error_log   logs/error.log;

pid   logs/nginx.pid;

events 
      {
        worker_connections  2048;
      }

# Main server config

http {
    include       mime.types;
    default_type  application/octet-stream;

    #Fusion Passenger Config
    passenger_root /home/ash/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.8;
    passenger_ruby /home/ash/.rvm/wrappers/ree-1.8.7-2011.03/ruby;
    passenger_min_instances 2;
    passenger_pool_idle_time 1200;
    passenger_max_pool_size 10;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                   '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
    #tcp_nopush     on;

    sendfile        on;
    keepalive_timeout  65;
    gzip  on;

    #Virtual Hosts

    include /opt/nginx/conf/sites-enabled/*.conf;
}
link|improve this question
It baffles me because line 39 is the last line. – Ash Sep 15 '11 at 19:25
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.