1

I'm trying to setup a server with Nginx and PHP FPM and I ran into some trouble.

I've set up an Nginx virtual host and a fpm pool for each website. The problem is that all domains are showing the same website, even though it's not the default one.

Below you have some example configuration (I have stripped parts I didn't change from the config):

This is the config for the domain that gets all other domains redirected to:

server {
        listen 80;
        listen [::]:80;
        root /var/www/site1;
        server_name sitename.com www.sitename.com;

        location ~ \.php$ {
               try_files $uri =404;
                fastcgi_keep_conn on;
                fastcgi_pass unix:/var/run/php5-fpm.site1.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                fastcgi_read_timeout 36000;
    }
    }

This is the site1.conf file in /etc/php5/fpm/pool.d:

[android]
user = site1
listen = /var/run/php5-fpm.site1.sock
listen.owner = www-data //I also tried with site1

I have created the user with useradd -M site1.

The /var/www/site1 folder has the right permissions and is owned by site1.

All the other virtual hosts in Nginx are identical to this one, except for the server_name, root and factcgi_pass. They all have a fpm pool, user, folder owned by the user.

I even have a default virtual host with listen 80 default and server_name as the server's IP, but even the server ip redirects to site1.

P.S. If I delete site1 from /etc/nginx/sites-enabled none of the websites work anymore.

What am I missing here?

1 Answer 1

1

I have found the problem.

I did the symlink wrong from sites-available to sites-enabled and only site1 worked, while the other files were empty.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .