当前位置:Gxlcms > PHP教程 > 请问nginx怎么安装证书

请问nginx怎么安装证书

时间:2021-07-01 10:21:17 帮助过:26人阅读

百度教程,打开了nginx配置文件,但是找不到https Server,本人小白,在线等大神解答

回复内容:

百度教程,打开了nginx配置文件,但是找不到https Server,本人小白,在线等大神解答

    # HTTPS server
    
    server {
        listen       443 ssl;
        server_name  你的域名;

        location 项目路径/ {
            root   html;
            index  index.php index.html index.htm;
        }

        ssl on;
        ssl_certificate 证书路径/ssl-unified.crt;
        ssl_certificate_key 私匙路径/de_ssl.key;
        
        ssl_session_cache    shared:SSL:20m;
        ssl_session_timeout  60m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
    }

然后再将http请求转到https

server {
  listen      80;
  server_name 你的域名;
  rewrite ^/(.*)$ https://你的域名/$1 permanent;
}

人气教程排行