Heim  >  Fragen und Antworten  >  Hauptteil

So konfigurieren Sie SSL in Nginx, um sowohl http- als auch https-Zugriff zu ermöglichen

Nach der Konfiguration springt der Zugriff auf http automatisch zu https- -. Es tut so weh

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;
}
仅有的幸福仅有的幸福2712 Tage vor545

Antworte allen(4)Ich werde antworten

  • ringa_lee

    ringa_lee2017-05-16 17:30:38

    这个在Nginx的文档中有的:

    listen              80;
    listen              443 ssl;
    

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

    Antwort
    0
  • 天蓬老师

    天蓬老师2017-05-16 17:30:38

    两个server行不行?

    Antwort
    0
  • 世界只因有你

    世界只因有你2017-05-16 17:30:38

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

    Antwort
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:30:38

    ssl on; 把这行去掉就好了

    Antwort
    0
  • StornierenAntwort