09-24 17:24 nginx 技巧 nginx 配置 https #### 首先获取证书pem和key,并开放服务器80和443端口 #### 修改网站配置文件 ```shell server { listen 80; server_name www.varwill.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl; index index.php index.html; server_name www.varwill.com; root /usr/xxx; ssl_certificate /xxx/cert/xxx.pem; ssl_certificate_key /xxx/cert/xxx.key; location ~ \.php$ { fastcgi_pass 172.18.0.3:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } ``` #### 最后重启nginx既可