Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have tried to install php5-fpm and Nginx on Ubuntu machine, but I got a problem. When I have only one virtual host on a unix port it is all fine but when I try to add another virtual host Nginx goes to default web page "Welcome to Nginx!" but when I run it on a tcp port example port 9000 it work fine with multisites. It is a fresh install of ubuntu 11.10, Nginx 1.2.3 with php5-fpm installed. It also has extra php installs such as php-apc. I can only give the links to the virtual hosts because I am doing it from a mobile phone. Here are the links for the two virtual hosts I am using: http://ic0nic.co.uk/ic0nic.txt, http://ic0nic.co.uk/sourproxy.txt also I want to use unix port because I find it a whole lot faster.

Edit: Here are the nginx configs

    server {
    server_name ic0nic.co.uk www.ic0nic.co.uk;
    root /var/www/ic0nic.co.uk;
    listen 8080;
    index index.html index.htm index.php;

    include conf.d/drop;

        location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        location ~ \.php$ {
            fastcgi_buffers 8 256k;
            fastcgi_buffer_size 128k;
            fastcgi_intercept_errors on;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass unix:/dev/shm/php-fpm-www.sock;
        root /var/www/ic0nic.co.uk;

        }
}

server {
    server_name sourproxy.co.uk www.sourproxy.co.uk;
    root /var/www/sourproxy.co.uk/;
    listen 8080;
    index index.html index.htm index.php;

    include conf.d/drop;

        location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        location ~ \.php$ {
            fastcgi_buffers 8 256k;
            fastcgi_buffer_size 128k;
            fastcgi_intercept_errors on;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME /var/www/sourproxy.co.uk$fastcgi_script_name;
            fastcgi_pass unix:/dev/shm/php-fpm-www.sock;


        }
}
share|improve this question

1 Answer 1

Your configuration seems confused to me. Please change your configuration like the following and tell me if this solves the problem. If not please post your nginx error log.

# /etc/sites-available/server.conf

listen 8080;
index index.html index.htm index.php;
include conf.d/drop;
location / {
  location ~* \.php$ {
    fastcgi_buffers 8 256k;
    fastcgi_buffer_size 128k;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass unix:/dev/shm/php-fpm-www.sock;
  }
  try_files $uri $uri/ /index.php?q=$uri&$args;
}

Your actual virtual host configuration for ic0nic.co.uk:

# /etc/sites-available/ic0nic.co.uk.conf

server {
  server_name ic0nic.co.uk www.ic0nic.co.uk;
  root /var/www/ic0nic.co.uk;
  include sites-available/server.conf;
}

Your actual virtual host configuration for sourproxy.co.uk:

# /etc/sites-available/sourproxy.co.uk.conf

server {
  server_name sourproxy.co.uk www.sourproxy.co.uk;
  root /var/www/sourproxy.co.uk;
  include sites-available/server.conf;
}

Please note that this configuration is far from being ideal. For instance the index directive should go directly into your nginx.conf within the http context.

Have you verified your php-fpm configuration to use sockets instead of listening on a TCP port? Check the pool configurations and if everything is fine in there enter netstat -an, you should see the php-fpm sockets listed there.

Always check the error log. You can simply cat /dev/null > /var/log/nginx/error.log to purge the log file. Start nginx and php-fpm and try to open your website. Post the result of the log file here!

share|improve this answer

Your Answer

 
discard

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.