nginx 502 Bad Gateway on every external site

Posted by Leandros on Server Fault See other posts from Server Fault or by Leandros
Published on 2013-08-09T16:54:56Z Indexed on 2014/06/04 3:27 UTC
Read the original article Hit count: 445

Filed under:
|
|

I just installed nginx and followed the guides on the official site, to set it up with php5-fpm, but it just won't work. Not even the default site, without php is working outside of my server.

Tried listen = 127.0.0.1:7777 and listen = /var/run/php5-fpm.sock Both don't work.

I can access http://localhost with lynx on my server, but not from somewhere else (with external ip obviously).

Yes, the php5-fpm deamons are running, yes the port (80 and 7777) is opened.

Don't work with php-cgi as well.

My config:

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # nginx-naxsi config
        ##
        # Uncomment it if you installed nginx-naxsi
        ##

        #include /etc/nginx/naxsi_core.rules;

        ##
        # nginx-passenger config
        ##
        # Uncomment it if you installed nginx-passenger
        ##

        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;

        proxy_buffers 16 16k;
        proxy_buffer_size 32k;

        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;

        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
}

Server config: (symlinked to sites-enabled)

server
{
  server_name skilloverflow.de *.skilloverflow.de;
  root /var/www/blog.skilloverflow.de/htdocs;

  index index.php;

  error_log /var/log/nginx/skilloverflow.error.log;
  access_log /var/log/nginx/skilloverflow.access.log;

  location = /favicon.ico {
    log_not_found off;
    access_log off;
  }

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

  location / {
    # This is cool because no php is touched for static content.
    # include the "?$args" part so non-default permalinks doesn't break when using query string
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    if (!-f $document_root$fastcgi_script_name) {
      return 404;
    }

    fastcgi_pass 127.0.0.1:7777;
    fastcgi_index index.php;
    include fastcgi_params;
  }

  location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
  }

  # deny access to apache .htaccess files
  location ~ /\.ht
  {
    deny all;
  }

  # deny access to apache .htaccess files
  location ~ /\.ht
  {
    deny all;
  }
}

PHP Version: 5.4.17-1
nginx version: 1.2.1
Debian 6.0.7
Linux 2.6.32

Edit: Lighttpd is still installed, does that matter? It's not running though. Edit 2: No error or access log is generated. They're all empty.

© Server Fault or respective owner

Related posts about linux

Related posts about nginx