1、将phpstudy
切换成 nginx+php+mysql
环境
2、然后在 vhosts.conf
增加如下配置:
server {
listen 80;
server_name 798ziyuan.com;
root "C:/ruanjian/PHPStudy/PHPTutorial/WWW";
autoindex on; #开启nginx目录浏览功能
autoindex_exact_size off; #文件大小从KB开始显示
autoindex_localtime on; #显示文件修改时间为服务器本地时间
location / {
index index.html index.htm index.php;
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
server {
listen 443;
root "C:/ruanjian/PHPStudy/PHPTutorial/WWW";
server_name 798ziyuan.com www.798ziyuan.com;
autoindex on; #开启nginx目录浏览功能
autoindex_exact_size off; #文件大小从KB开始显示
autoindex_localtime on; #显示文件修改时间为服务器本地时间
ssl on;
ssl_certificate www.798ziyuan.com/full_chain.pem;
ssl_certificate_key www.798ziyuan.com/private.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
location / {
#root html;
index index.html index.htm index.php;
}
location = /favicon.ico {
log_not_found off; access_log off;
}
}
备注:
1、这边的ssl证书是放在 vhosts.conf
同级目录下,就是 C:\ruanjian\PHPStudy\PHPTutorial\nginx\conf
来源:CSDN
作者:西安很远
链接:https://blog.csdn.net/xianhenyuan/article/details/103684767