2017-06-01 13 views
0

基本的には、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のいくつかのインスタンスを使用する必要がありますか?

答えて

1

secondeファイルが有効になっていて、間違ったnginxがサーバーエラーを引き起こしていて、あなたのドメイン名から問題が発生していると思われる場合は、設定が間違っているか、まだ伝播されていない可能性があります。

0

ローカルマシンでGoogle public DNSを使用していたため、解決されませんでした(誰が考えていたでしょう)

関連する問題