Home > Article > Backend Development > How to install certificate in nginx
百度教程,打开了nginx配置文件,但是找不到https Server,本人小白,在线等大神解答
百度教程,打开了nginx配置文件,但是找不到https Server,本人小白,在线等大神解答
<code class="conf"> # 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; }</code>
然后再将http请求转到https
<code class="conf">server { listen 80; server_name 你的域名; rewrite ^/(.*)$ https://你的域名/$1 permanent; }</code>