我正在嘗試使用NGINX設置SSL。
在更改爲443並添加文件路徑之前,它與端口80一起工作。SSL NGINX不會加載
我生成了csr和key。
openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr
我跟着this guide和this guide並已收到我的CRT和CA-束從Namecheap /科摩多。
我結合爲NGINX文件:
cat example_com.crt example_com.ca-bundle >> cert_chain.crt
,放入/etc/nginx/ssl/
。
設置權限
sudo mkdir /etc/nginx/ssl
sudo chown -R root:root /etc/nginx/ssl
sudo chmod -R 600 /etc/nginx/ssl
sudo ls -l
回報-rw------- 1 root root
站點,均可提供:
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/cert_chain.crt;
ssl_certificate_key /etc/nginx/ssl/example_com.key;
...
我/etc/nginx/nginx.conf
不使用任何端口,那所有的例子。 com網站 - 可用。
當我重裝NGINX:
sudo systemctl reload nginx
或sudo systemctl restart nginx
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Sun 2017-03-26 22:16:54 UTC; 5h 8min ago
Process: 3998 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 3993 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=1/FAILURE)
Process: 3885 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 4000 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Main PID: 3888 (code=exited, status=0/SUCCESS)
'nginx -t'的結果是什麼? –