Несколько доменов на одном разделе с использованием Nginx

Я хочу запустить много веб-сайты на одной сервисе, проблема в обоих доменах перенаправляется на domain1

domain1.com.conf

server {
        listen 80;
        listen [::]:80;
        root /var/www/domain1;
        index index.php index.html;
        server_name domain1.com www.domain1.com;



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

        location ~ \.php$ {
                     
                     fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        }     

domain2.com.conf

server {
        listen 80;
        listen [::]:80;
        root /var/www/domain2;
        index index.php index.html;
        server_name domain2.com www.domain2.com;



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

        location ~ \.php$ {
                     
                     fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        }     
0
задан 24 March 2021 в 22:18

1 ответ

Это один из моих конфигураций виртуальных хостов NGINX. Этому работает так, что я думаю, что это ДОПОДАМИ К ТЕХНОМУ ARCANE FASTCGI Parms`

server {
    listen 80;
    server_name collect.local;
    index index.php index.html index.htm;
    root /var/www/html/collectd-html;

    location / {
       try_files $uri $uri/ =404;
    }

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

Я бы подозреваю этих ...

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
0
ответ дан 1 April 2021 в 23:00

Другие вопросы по тегам:

Похожие вопросы: