" ssl_certificate_key"中的参数数量无效; / etc / nginx / sites-enabled / defaul中的指令

时间:2015-10-07 20:17:17

标签: ubuntu ssl nginx certificate

我已获得EV证书。我正在学习如何在Ubuntu上使用我的证书和NGINX的教程

当我尝试重新启动我的nginx时,我得到:

**invalid number of arguments in "ssl_certificate_key" directive in   /etc/nginx/sites-enabled/default

到目前为止我做了什么:

sudo nano /etc/nginx/sites-enabled/default


upstream app {
# Path to Unicorn SOCK file, as defined previously
server unix:/home/zhall/zoulfia/shared/sockets/unicorn.sock fail_timeout=0;
}

server {
listen 80;
server_name moneytree.space www.moneytree.space " " 178.62.19.65;
rewrite ^/(.*) https://moneytree.space/$1 permanent;
}

# HTTPS server

server {
listen 443;
server_name moneytree.space www.moneytree.space " " 178.62.19.65;
root /home/zhall/zoulfia/public;


ssl on;
ssl_certificate /home/zhall/moneytree.space.chained.crt;

**ssl_certificate_key /home/zhall/ moneytree.space.key**

ssl_session_timeout 10m;

ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;

location / {
try_files $uri $uri/ =404;
}
}

当我用---

重新启动nginx时
sudo service nginx restart

在我的日志文件中----

sudo nano /var/log/nginx/error.log, I get:

**invalid number of arguments in "ssl_certificate_key" directive in    /etc/nginx/sites-enabled/default

对我来说一切都是新的,所以我需要你的帮助来解决这个问题。我做错了什么,最重要的是如何纠正这个错误?

谢谢你, Zoulfia

3 个答案:

答案 0 :(得分:56)

看起来您可能在var list = [0,1,2] list.unshift(3) // results [3,0,1,2] 行的末尾错过了分号。

答案 1 :(得分:0)

“/ home / zhall /”和“moneytree.space.key”之间有空格,nginx看到2个参数而不是一个

答案 2 :(得分:0)

由于 ssl.conf 文件中的“=”,我遇到了同样的错误。

正确

ssl_certificate_key '/etc/letsencrypt/live/mysite/privkey.pem';

不正确

ssl_certificate_key =  '/etc/letsencrypt/live/mysite/privkey.pem';