我使用SSL设置nginx服务器。Nginx重定向http https不工作
与SSL域名dev.cooknconnect.com 我想重定向所有请求:http://domain.com到https://domain.com 我目前有以下服务器模块的设置:
server {
listen 1.2.3.4:80 default;
server_name domain.com;
server_tokens off;
rewrite ^https://$server_name$request_uri? permanent;
}
server {
listen 443 ssl;
server_name domain.com www.domain.com;
keepalive_timeout 70;
server_tokens off;
ssl on;
ssl_certificate /etc/ssl/certs/certificate.crt;
ssl_certificate_key /etc/ssl/private/certificate.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
location/{
proxy_pass http://domain.com;
}
}
目前这是不行的,但我不明白为什么不能。任何人都可以在我的配置中找到任何错误。如果不是,请提出一些方法来跟踪或调试相同的。
为什么它是'listen IP:80'而不是'listen 80'? –
最初我试着用“听80”。但那次nginx没有重启。 – user3518256
nginx报告什么错误? –