Nginx 意外的文件结束

Nginx 意外的文件结束

我在docker容器中设置了nginx(https://hub.docker.com/r/aptalca/nginx-letsencrypt/)。进行了一些更改(添加了最后一个位置块),现在 nginx 无法启动。使用 nginx 配置检查器(nginx -t)它告诉我第 74 行有一个错误:

[emerg] unexpected end of file, expecting ";" or "}" in /config/nginx/site-confs/default:74

我已附加了 的内容default,但我真的不明白为什么会出现这种情况。据我所知,我的所有块都已正确关闭。第 74 行引用了文件的最后一行:

server {
        listen       80;
        server_name  www.example.com, 192.168.187.10;
        rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
}


server {
        listen 443 ssl default_server;

        root /config/www;
        index index.html index.htm index.php;

        server_name www.example.com, 192.168.187.10;

        ssl_certificate /config/keys/fullchain.pem;
        ssl_certificate_key /config/keys/privkey.pem;
        ssl_dhparam /config/nginx/dhparams.pem;
        ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA$
        ssl_prefer_server_ciphers on;

        proxy_set_header X-Forwarded-For $remote_addr;
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
        client_max_body_size 0;

        location / {
                try_files $uri $uri/ /index.html /index.php?$args =404;
        }

        location ~ \.php$ {
                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;
        }

        location /couchpotato {
                proxy_pass http://192.168.187.10:5050/couchpotato;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location /sonarr {
                proxy_pass http://192.168.187.10:8989/sonarr;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location /deluge {
                proxy_pass http://192.168.187.10:8112/;
                proxy_set_header X-Deluge-Base "/deluge/";
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location /emby {
                proxy_pass http://192.168.187.10:8096/emby;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        location /zm {
                proxy_pass http://192.168.187.10:808/zm;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

}

有人能看出这个问题吗?

答案1

就我而言,由于“ssl ciphers”行太长,使用鼠标复制它会截断它并删除结尾的分号。

在 nano 中,分别使用 ^K 和 ^U 进行剪切和粘贴。

答案2

您是否尝试过在该行中添加分号:

ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA$;

相关内容