基本的には、1つのホスティングに2つのサイトと1つのドメイン名を論理的に分離する必要があります。 まず、CNAMEレコードを使用してサブドメインを設定しました。Nginxとphp-fpmを使用したドメインとサブドメイン
subdomain.conf
server {
listen 80;
server_name sub.domain.com;
index index.php index.html;
root /web/www/sub.domain.com;
access_log off;
server_tokens off;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/webserv/var/php-cgi.sock;
fastcgi_index index.php;
include /webserv/nginx/conf/fastcgi.conf;}}
domain.conf
server {
listen 80;
server_name domain.com;
index index.php index.html;
root /web/www/domain.com;
access_log off;
server_tokens off;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/webserv/var/php-cgi.sock;
fastcgi_index index.php;
include /webserv/nginx/conf/fastcgi.conf;}}
しかし、唯一:それから私は、ドメインとサブドメイン(構文エラー、変更後に再起動nginxの)のための2つのファイルを作成しましたそれらのうちの1つが動作していて、ブラウザのリクエストがnginxにも届かず、最終的にはページの読み込み時間が長すぎたという。これを行う最も簡単な方法は何ですか? nginx、php-fpmのいくつかのインスタンスを使用する必要がありますか?