nginx配置错误:“ [emerg]文件意外结束,期望为“;”或“}”

时间:2019-02-15 02:52:17

标签: nginx

在尝试启动Nginx时,我在下面的Nginx配置下遇到此错误:

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 164;
    # 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/*;


upstream qe {
 server qe.domain.com:443;
}

upstream staging {
 server staging.domain.com:443;
}

upstream beta  {
 server mydomain.com:443;
 server mydomain-beta.com:443;
}

# map to different upstream backends based on header
map $http_x_server_select $pool {
 default "staging";
 qe "qe";
 beta "beta";
}

   server {
     listen 80;
 server_name 100.0.0.0 ec2.instance.compute-1.amazonaws.com;
 location / {
      proxy_pass https://$pool;

      #standard proxy settings
      proxy_set_header X-Real-IP $remote_addr;
      proxy_redirect off;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-NginX-Proxy true;
      proxy_connect_timeout 600;
      proxy_send_timeout 600;
      proxy_read_timeout 600;
      send_timeout 600;
 }
}
}

#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;
#       }
#

一切似乎都准备就绪,但仍然看到此错误。我想念什么吗?我肯定不是将大括号引起的,因为我已经将大括号固定到位。但不确定是什么导致了此错误。

它在配置文件的最后一行给出错误,在该行中我有一些注释配置,这是我安装nginx时默认出现的。但是不要以为这也是我尝试删除它的原因。

更新:因此我从配置文件中删除了所有内容,但仍然收到相同的错误。我很困惑现在发生了什么。

0 个答案:

没有答案