我的Nginx配置中只定义了一个端口

时间:2015-08-07 17:30:55

标签: ubuntu nginx server ubuntu-14.04

我的服务器仅适用于端口8000(MY.IP.AD.DRESS:8000)上定义的网站,而不适用于端口8888上定义的站点。我的Nginx配置如下:

server {
listen 8000 default_server;
listen [::]:8000 default_server ipv6only=on;

root /var/www/my-follow-up/public;
index index.php index.html index.htm;

server_name http://64.46.53.164/;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
    try_files $uri /index.php =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;
}
}

server {
listen 8888;
listen [::]:8888 default_server ipv6only=on;

root /var/www/my-follow-up-external/public;
    index index.php index.html index.htm;

server_name http://64.46.53.164/;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
            try_files $uri /index.php =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;
    }

我已经为两个根目录提供了正确的用户权限。当我尝试导航到MY.IP.AD.DRESS:8888时,我收到“ERR_CONNECTION_REFUSED”错误。

1 个答案:

答案 0 :(得分:0)

我解决了这个问题,我并没有想到。

我无法使用端口8888.将其切换到8080并且工作正常。