Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 = 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/;

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_name *;
  root /var/www/;

  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_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.

share|improve this question
what does your fpm-config look like? – etagenklo Aug 9 '13 at 17:06
Do you mean /etc/php5/fpm/php-fpm.conf? I haven't touched it, it's completely default. – Leandros Aug 9 '13 at 17:09
did you configure an fpm-pool? what's in it? – etagenklo Aug 9 '13 at 17:21
I just installed php5-fpm and changed the listen method from socket to the local ip. – Leandros Aug 9 '13 at 17:24
what does netstat -tlnp say? Is php-fpm listening? – etagenklo Aug 9 '13 at 17:45

If you upgraded to PHP 5.5.12 then open up /etc/php5/fpm/pool.d/www.conf and uncomment the following listen directives:

listen.owner = www-data = www-data
listen.mode = 0660

then restart php5-fpm after that.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.