首页 > nginx怎么配置ssl可以即允许http访问也允许https访问

nginx怎么配置ssl可以即允许http访问也允许https访问

现在配置好后访问http会自动跳转到https- -。好蛋疼

server {
    listen 80;
    listen 443;

    server_name *.domain.com;
    root /data0/web/domian.com;
    index index.php;

    ssl on; 
    ssl_certificate /data0/configs/domain.com.crt; 
    ssl_certificate_key /data0/configs/domain.com.pem;

    location / {
    }

    include php.conf;
}

两个server行不行?


楼主这么配置不行吧,应该要两个server,一个监听的是80端口,一个监听的是443端口。酱紫...


这个在Nginx的文档中有的:

listen              80;
listen              443 ssl;

参考:http://nginx.org/en/docs/http/configuring_https_servers.html

【热门文章】
【热门文章】