windows下安装web服务器

时间:2024-10-25 16:03:50

有条件下还是在linux下部署。window上真心问题挺多的。

推荐安装Visual-NMP,轻量级、组件升级方面等。

Nginx绑定IPv4和IPv6的方法

listen 80;

listen [::]:80 ipv6only=on;

兼容Thinkphp

server {
###SiteName WEB
listen *:80;
server_name localhost www.xxx.com xx.xx.xx.xx;
root "D:/Visual-NMP-x64/www/MC";
#error_log "D:/Visual-NMP-x64/logs/Nginx/MC_WEB-error.log";
#access_log "D:/Visual-NMP-x64/logs/Nginx/MC_WEB-access.log";
autoindex on;
index index.php index.html index.htm; location / {
index index.htm index.html index.php;
#访问路径的文件不存在则重写URL转交给ThinkPHP处理
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
} location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php; #设置PATH_INFO,注意fastcgi_split_path_info已经自动改写了fastcgi_script_name变量,
#后面不需要再改写SCRIPT_FILENAME,SCRIPT_NAME环境变量,所以必须在加载fastcgi.conf之前设置
fastcgi_split_path_info ^(.+\.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;
}