证书颁发成功,配置nginx后却无法访问到网站。
来源:11-2 云平台申请免费证书及 Nginx 配置
楼燕
2017-08-01
1、去申请了ssl证书,并把证书添加为TXT并解析。
2、下载证书并上传到服务器,配置nginx如下:
upstream tdocshouji {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name t.docshouji.cn;
rewrite ^(.*) https://$host$1 permanent;
}
server {
listen 443;
server_name t.docshouji.cn;
ssl on;
ssl_certificate /home/mooc/www/ssl/1_t.docshouji.cn_bundle.crt;
ssl_certificate_key /home/mooc/www/ssl/2_t.docshouji.cn.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
if ($ssl_protocol = ""){
rewrite ^(.*) https://$host$1 permanent;
}
location / {
root /home/mooc/www/website/production/current;
index index.html index.htm;
}
location /api {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Nginx-Proxy true;
proxy_pass http://tdocshouji;
proxy_redirect off;
}
}
配置后的域名为:t.docshouji.cn
就是访问不到不知道什么情况,求助
1回答
-
Scott
2017-08-03
改成这样呢?
location / { root /home/mooc/www/website/production/current; index index.html index.htm; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-Nginx-Proxy true; proxy_pass http://tdocshouji; proxy_redirect off; }
042017-09-10
相似问题