I
I
Ilia Malashko2020-02-24 11:52:36
linux
Ilia Malashko, 2020-02-24 11:52:36

Why do all domains serve content from one site (nginx+php-fpm)?

I am studying linux administration, I have a question about basic settings, but I did not find a single article that solves my problem.

I configured site1.ru for the first domain without any problems. I installed phpmyadmin, but when I go to {server ip}/phpmyadmn, it gives site1.ru. I postponed
this question, connected site2.ru, but at site2.ru it also gives content from site1.ru.

Configs in the pool /etc/php/7.2/fpm/pool.d/site1.ru.conf:

[site1]
user = site1.ru
group = site1.ru
listen = /var/run/php5-fpm-site1.ru.sock
listen.owner = www-data
listen.group = www-data
php_admin_value[disable_functions] = exec,passthru,shell_exec,system
php_admin_flag[allow_url_fopen] = off
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /

/etc/php/7.2/fpm/pool.d/site2.ru.conf is similar to site2.ru user data

nginx config /etc/nginx/sites-available/site1.ru.conf:
server {
listen 80 default_server;

root /var/www/8991.ru/public_html/;
index index.php index.html index.htm;
server_name 8991.ru www.8991.ru;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm-site1.sock;
include snippets/fastcgi-php.conf;
}
}

/etc/nginx/sites-available/site2.ru.conf is similar.

There are no errors. Tell me where could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2020-02-24
@miv-men

Remove default_server from the config of the second site. In general, it is better to leave the default site only by SP, not even a site, but a stub.

V
Victor Taran, 2020-02-24
@shambler81

listen 80 default_server; What is this ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question