Nginx:如何为2个域设置不同的IP

时间:2017-12-22 10:04:50

标签: nginx

我为我的域设置不同的ip有问题,我读到:

Different Domains on Different IP's in Nginx?

但是这个解决方案不起作用。

(我添加了新的ip with command:ip address add 1.2.3.4/32 dev eth0 and with ip ip FTP工作正常)

我在"中设置了新的IP":

    server {
listen 1.2.3.4:80;
#listen [::]:80;


root /var/www/domain.com/public_html;
index index.html index.htm index.php;

server_name domain.com www.domain.com;

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

location ~ \.php {
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    if (-f $document_root$fastcgi_script_name){
        set $fsn $fastcgi_script_name;
}
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

但是当我ping domain.com时,我还有旧的IP。 为什么不改变?

0 个答案:

没有答案