编辑Nginx网站配置文件,通常目录位于…/Nginx/conf/vhosts.con
在修改之前请记得备份文件,切记切记要备份!
主要修改区域已在图片中以红框标注,我们对应自己的修改
通常只需要修改域名以及CRT与KEY为自己的或者直接在现有网站配置文件中添加上图红色区域配置信息并修改即可。注意CRT与KEY使用绝对路径
编辑完成之后记得重启环境。
代码:
server { listen 127.0.0.1:80; listen 127.0.0.1:443 ssl; server_name www.fuwuqijia.com alias fuwuqijia.com; ssl_certificate E:/UPUPW/Nginx/conf/ssl/server.crt; ssl_certificate_key E:/UPUPW/Nginx/conf/ssl/server.key; ssl_session_timeout 5m; ssl_protocols SSLv2 SSLv3 TLSv1; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; if ($scheme = http) { return 301 https://$host$request_uri; } location / { root E:/web; index index.html index.htm default.html default.htm index.php default.php app.php u.php; include E:/web/up-*.conf; } autoindex off; include advanced_settings.conf; #include expires.conf; location ~* .*\/(attachment|attachments|uploadfiles|avatar)\/.*\.(php|php5|phps|asp|aspx|jsp)$ { deny all; } location ~ ^.+\.php { root E:/web; fastcgi_pass bakend; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param HTTPS $https if_not_empty; include fastcgi.conf; } }