Nginx“无法启动高性能 Web 服务器和反向代理服务器。”

Nginx“无法启动高性能 Web 服务器和反向代理服务器。”

systemctl status nginx.service 输出:

    ● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2019-01-23 19:04:12 +03; 1min 1s ago
     Docs: man:nginx(8)
  Process: 10511 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Jan 23 19:04:12 linux systemd[1]: Starting A high performance web server and a reverse proxy server...
Jan 23 19:04:12 linux nginx[10511]: nginx: [emerg] a duplicate default server for [::]:80 in /etc/nginx/sites-enabled/default:23
Jan 23 19:04:12 linux nginx[10511]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jan 23 19:04:12 linux systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jan 23 19:04:12 linux systemd[1]: nginx.service: Failed with result 'exit-code'.
Jan 23 19:04:12 linux systemd[1]: Failed to start A high performance web server and a reverse proxy server.

journalctl -xe 输出:

-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- An ExecStartPre= process belonging to unit nginx.service has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 1.
Jan 23 19:10:15 linux systemd[1]: nginx.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jan 23 19:10:15 linux systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: A start job for unit nginx.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A start job for unit nginx.service has finished with a failure.
-- 
-- The job identifier is 2656 and the job result is failed.
Jan 23 19:10:15 linux sudo[10625]: pam_unix(sudo:session): session closed for user root
Jan 23 19:10:23 linux sudo[10631]:  lvlzyro : TTY=pts/0 ; PWD=/home/lvlzyro ; USER=root ; COMMAND=/usr/bin/journalctl -xe
Jan 23 19:10:23 linux sudo[10631]: pam_unix(sudo:session): session opened for user root by (uid=0)

nginx.conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
# 
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

我该怎么做才能解决这个问题?顺便说一句,谢谢你的关注。

答案1

只有 2 个网站使用相同的端口,我刚刚删除了其中一个

相关内容