ポート変更後にnginxが再起動されない

ポート変更後にnginxが再起動されない

nginxがリッスンするポートを80から6000に変更してみました。ただし、再起動しようとすると、このメッセージが表示されます。

Restarting nginx: nginx: [emerg] bind() to 0.0.0.0:6000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:6000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:6000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:6000 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:6000 failed (98: Address already in use)
nginx: [emerg] still could not bind()

私のサイトで有効になっている設定は次のとおりです。

server {
    listen   6000; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

    root /var/www/mywebsite.co/html;
    index index.html index.htm;

    # Make site accessible from http://localhost/
    server_name mywebsite.co www.website.co;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            try_files $uri $uri/ /index.html;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules
    }

    location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            allow ::1;
            deny all;
    }
}

0.0.0.0:6000サーバーがあるIPアドレスでなければならないと思いますが、192.168.1.3:6000どうすればいいかわかりません。どんな助けでも大変感謝します。

ベストアンサー1

変更を試す#listen [::]:80 default_server ipv6only=on; ## listen for ipv6

到着する: listen [::]:6000 ipv6only=on default_server;

それでも問題が解決しない場合は、netstat -natp | grep 6000より多くの情報を表示できます。

おすすめ記事