Nginx配置阿里云域名

阿里云获取证书这里不描述。只记录Nginx操作

在NginxC:\nginx-1.10.3\nginx-1.10.3\conf目录下新建文件夹,如:cert。配置阿里云证书的key,和pem文件

 

 之后在Nginx.conf文本中配置如下:

 server {
       listen 443 ssl;
       server_name lidsk.top;
        ssl_certificate   cert/6199992_lidsk.top.pem;
        ssl_certificate_key  cert/6199992_lidsk.top.key;
        ssl_session_timeout 5m;
        ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; #按照这个套件配置
        ssl_prefer_server_ciphers  on; 
    root /;
        location /{
            root   C:\dist;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }
View Code

路径对应新建文件夹中的文件

 

posted @ 2021-10-29 10:37  初见如月  阅读(318)  评论(0编辑  收藏  举报