私は数日間、Ubuntu 14.04サーバーに複数のドメインを設定する方法をnginxを使って調べようとしています。Nginx複数のドメイン
#Domain + IP one.
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/alive.gg/html;
index index.php index.html index.htm;
#149.202.86.66 IP ONE
server_name alive.gg www.alive.gg;
location/{
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
#Domain + IP two
server {
listen 80;
listen [::]:80;
root /var/www/blazeplay.com/html;
index index.php index.html index.htm;
#213.186.35.171 IP TWO
server_name blazeplay.com www.blazeplay.com;
location/{
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
私の/ etc/network/interfacesには、最後の1は、第二IP Iという
auto eth0
iface eth0 inet static
address 149.202.86.66
netmask 255.255.255.0
network 149.202.86.0
broadcast 149.202.86.255
gateway 149.202.86.254
post-up /sbin/ifconfig eth0:0 213.186.35.147 netmask 255.255.255.255 br$
post-down /sbin/ifconfig eth0:0 down
post-up /sbin/ifconfig eth0:1 213.186.35.167 netmask 255.255.255.255 br$
post-down /sbin/ifconfig eth0:1 down
post-up /sbin/ifconfig eth0:2 213.186.35.171 netmask 255.255.255.255 br$
post-down /sbin/ifconfig eth0:2 down
ファイル:私は私の/ etc/nginxの/サイト利用可能/ defaultファイルで
使いたい私は自分のドメインのDNSをリダイレクトした
(213.186.35.171)、例Blazeplay.comよう:
私はBlazeplay.comに行くとき今、何が起こるA @ 213.186.35.171
: 私は正しいページ/var/www/blazeplay.com/html
を表示することができます - しかし、それはCSS
IMG
などをロードすることができません、それは404エラーをスローします。私のWordPressログインサイト/ wp-adminに行くと正しいIPにリダイレクトされますが、私がenterキーを押すと、もう一度alive.ggドメインにリダイレクトされます。別名default_server
だから、私はdefault_server
になってから間違った何かを設定したに違いない。これは私が何をすべきかに迷っています。なぜなら、server_name blazeplay.com www.blazeplay.com;
をIPアドレス213.186.35.171に置き換えた場合、ドメインの代わりにすべてが問題なく正しくロードされるからです。
あなたはドメインblazeplay.com/wp-adminに向かい、同じことがあなたに起こるはずですログインしようとすると、上記のすべての設定はまだ同じですので、気軽にお気軽に。
私はUbuntuやnginxのエキスパートではありませんが、複数のドメインを設定するための小さな手順がないのですか?または問題を特定するために何らかのトラブルシューティングを行うことはできますか?どんな助けでも大歓迎です!
その他の情報が必要な場合はお知らせください。 :-)
ありがとうございます。 virtual.confでthis articleを1として
残念ながら、/etc/nginx/conf.d/virtual.confにはサイトで使用可能な/サイト対応の設定ファイルのスケルトンが含まれていましたが、これをコピーして編集します。実際のブロックに使用されます。 – Codey93