Home > Backend Development > PHP Tutorial > How to install certificate in nginx

How to install certificate in nginx

WBOY
Release: 2016-10-24 00:12:42
Original
1331 people have browsed it

百度教程,打开了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>
Copy after login

然后再将http请求转到https

<code class="conf">server {
  listen      80;
  server_name 你的域名;
  rewrite ^/(.*)$ https://你的域名/$1 permanent;
}</code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template