无论我做什么,我的nginx服务器都无法启动

时间:2018-01-22 04:20:02

标签: nginx

on' sudo nginx',输出为:

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

on 'sudo netstart -tulpan', the output is:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      1417/mongod
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1443/mysqld
tcp        0      0 0.0.0.0:81              0.0.0.0:*               LISTEN      16662/nginx -g daem
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1428/sshd
tcp6       0      0 :::70                   :::*                    LISTEN      15680/apache2
tcp6       0      0 :::9000                 :::*                    LISTEN      15923/node
tcp6       0      0 :::8080                 :::*                    LISTEN      16630/node
tcp6       0      0 :::81                   :::*                    LISTEN      16662/nginx -g daem
tcp6       0      0 :::22                   :::*                    LISTEN      1428/sshd

配置文件是, ' sudo nano / etc / nginx / sites-available / default':

server {
        listen 81;
        listen [::]:81 ipv6only=on;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #

我真的需要帮助人员:请问如何让nginx服务器正常工作?

1 个答案:

答案 0 :(得分:0)

你的nginx已经在运行了,这就是原因。

当你运行nginx时,它会转到后台,你什么也看不见。

正如您从netstat中看到的,您的nginx已经在运行。

如果您想停止它,请使用nginx -s stop或重新使用nginx -s reload,再次使用nginx

运行nginx