나는 며칠을 nginx를 사용하여 우분투 14.04 서버에 여러 도메인을 설정하는 방법을 알아 내려고 노력하고 있습니다. 내/등 /의 nginx/사이트-가능/기본 파일에서Nginx multiple domains
내가 가진 :
#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/네트워크/인터페이스
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
2 IP I가되는 마지막 하나의 파일 내가 사용하려고하고있어. 내 도메인의 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로 리디렉션되지만 입력을 누르면 alive.gg 도메인으로 다시 리디렉션됩니다. 일명 default_server
인데, default_server
으로 바뀐 이래로 뭔가 잘못 설정 한 것 같습니다. 그리고 이것은 내가 무엇을해야 할지를 놓친 것이다. 왜냐하면 server_name blazeplay.com www.blazeplay.com;
을 IP 주소 213.186.35.171로 바꾸면 도메인 대신 모든 것이 문제없이 올바르게로드되기 때문입니다.
위의 설정을 자유롭게 사용해도 모든 설정이 동일하므로 blazeplay.com/wp-admin 도메인으로 이동하여 동일한 작업을 수행해야합니다.
저는 우분투 또는 nginx 전문가가 아니므로 여러 도메인을 구성하기위한 몇 가지 단계가 누락되었거나 문제를 해결하기 위해 문제를 해결할 수 있습니까? 어떤 도움이라도 대단히 감사합니다!
다른 정보가 필요하면 알려주십시오. :-)
읽어 주셔서 감사합니다. this article, virtual.conf에서 (/etc/nginx/conf.d/virtual.conf) 당신의 URL의에 대한 서버의 블록을 만드는 당으로
불행히도 /etc/nginx/conf.d/virtual.conf에는 사이트에서 사용 가능한/사이트가 활성화 된 구성 파일의 골격을 포함하고있었습니다. 그런 다음이 파일을 복사하여 편집 할 수 있습니다. '실제'블록에 사용됩니다. – Codey93