目录如下:
start_nginx.bat的内容是:
@echo off
REM Windows 下无效
REM set PHP_FCGI_CHILDREN=9
REM 每个进程处理的最大请求数,或设置为 Windows 环境变量
set PHP_FCGI_MAX_REQUESTS=1000
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php7.1/ -b 127.0.0.1:9000 -c D:/wnmp/php7.1/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php7.1/ -b 127.0.0.1:9001 -c D:/wnmp/php7.1/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php7.1/ -b 127.0.0.1:9002 -c D:/wnmp/php7.1/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php7.1/ -b 127.0.0.1:9003 -c D:/wnmp/php7.1/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php7.1/ -b 127.0.0.1:9004 -c D:/wnmp/php7.1/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php7.1/ -b 127.0.0.1:9005 -c D:/wnmp/php7.1/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php7.1/ -b 127.0.0.1:9006 -c D:/wnmp/php7.1/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php7.1/ -b 127.0.0.1:9007 -c D:/wnmp/php7.1/
echo Starting nginx...
RunHiddenConsole D:/wnmp/nginx/ -p D:/wnmp/nginx
start_nginx_5.的内容是:
@echo off
REM Windows 下无效
REM set PHP_FCGI_CHILDREN=9
REM 每个进程处理的最大请求数,或设置为 Windows 环境变量
set PHP_FCGI_MAX_REQUESTS=1000
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php5.6/ -b 127.0.0.1:9000 -c D:/wnmp/php5.6/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php5.6/ -b 127.0.0.1:9001 -c D:/wnmp/php5.6/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php5.6/ -b 127.0.0.1:9002 -c D:/wnmp/php5.6/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php5.6/ -b 127.0.0.1:9003 -c D:/wnmp/php5.6/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php5.6/ -b 127.0.0.1:9004 -c D:/wnmp/php5.6/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php5.6/ -b 127.0.0.1:9005 -c D:/wnmp/php5.6/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php5.6/ -b 127.0.0.1:9006 -c D:/wnmp/php5.6/
echo Starting PHP FastCGI...
RunHiddenConsole D:/wnmp/php5.6/ -b 127.0.0.1:9007 -c D:/wnmp/php5.6/
echo Starting nginx...
RunHiddenConsole D:/wnmp/nginx/ -p D:/wnmp/nginx
stop_nginx.bat内容如下:
@echo off
echo Stopping nginx...
taskkill /F /IM > nul
echo Stopping PHP FastCGI...
taskkill /F /IM > nul
exit
D:/wnmp/nginx/conf下面的的内容是:
#user nobody;
worker_processes 1;
#error_log logs/;
#error_log logs/ notice;
#error_log logs/ info;
#pid logs/;
events {
worker_connections 1024;
}
http {
include ;
client_max_body_size 20m;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/ ;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#添加这行的原因是如果每次只能访问一个文件,比如在下面访问了
#就不能再访问,可以在文件里面sleep(10)就可以知道访问
#必须在访问结束了才能进行,在网上找到了这段描述,加在http模块里面,同时将
#fastcgi_pass 127.0.0.1:9000;改为了fastcgi_pass phpfastcgi_proxy;
upstream phpfastcgi_proxy {
server 127.0.0.1:9000;
server 127.0.0.1:9001;
server 127.0.0.1:9002;
server 127.0.0.1:9003;
server 127.0.0.1:9004;
server 127.0.0.1:9005;
server 127.0.0.1:9006;
server 127.0.0.1:9007;
# 或更多……
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/ main;
root D:/wnmp/www;
location / {
index ;
}
#error_page 404 /;
# redirect server error pages to the static page /
#
error_page 500 502 503 504 /;
location = / {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
#root html;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass phpfastcgi_proxy;
fastcgi_index ;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias ;
# location / {
# root html;
# index ;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate ;
# ssl_certificate_key ;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index ;
# }
#}
include vhost/*.conf; #配置虚拟主机
}
vhost下面的(可以有多个,每个虚拟域名下面配置一个文件)某个虚拟主机的配置如下:
server {
listen 80;
server_name ; #可添加多个,多个之间“空格”分开
root D:/wnmp/www//public;
location / {
index ;
if (!-e $request_filename) {
rewrite ^/(.+)$ /?s=$1 last;
}
}
#autoindex on;#打开目录浏览,这样当没有找到index文件,就也已浏览目录中的文件
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9003;
fastcgi_pass phpfastcgi_proxy;
fastcgi_index ;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
可以根据需要启动不同的php版本