nginx 配置 https,及加载配置文件夹

首先需要去申请一个域名签名证书,在腾讯云,阿里云都有免费版,然后下载下来按如下配置,请根据自己路径更改

server {  
        listen  80;    
        server_name xxx.xxx.cn;
        root /home/wwwroot/xxxx/public;    
        listen 443 ssl;
        index index.php index.html index.htm;
	ssl_certificate_key /usr/local/nginx/cert/2588518_xxx.xxx.cn.key;
	ssl_certificate /usr/local/nginx/cert/2588518_xxx.xxx.cn.pem;
	ssl_session_timeout 5m;
	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
   	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
   	ssl_prefer_server_ciphers on;    
        location / {
          try_files $uri $uri/ /index.php?$query_string;    
        }
        
        location ~ \.php$ {    
            try_files $uri /index.php =404;
            fastcgi_pass 127.0.0.1:9000;    
            fastcgi_index /index.php;    
        
            fastcgi_split_path_info       ^(.+\.php)(/.+)$;    
            fastcgi_param PATH_INFO       $fastcgi_path_info;    
            fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;    
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;    
            include                       fastcgi_params;  
        }    
    }

  如何让nginx.con 加载自定义目录的配置文件

 

posted @ 2019-08-01 15:49  侯蜀黍  阅读(1084)  评论(0编辑  收藏  举报