一、下载nginx http://nginx.org/en/download.html 解压后进入目录双击nginx.exe就启动服务了
二、下载php http://php.net/downloads.php 解压后进入目录找到php.ini 配置一下
;extension=php_gd2.dll,删除前面的分号:extension=php_gd2.dll;extension=php_mbstring.dll,删除前面的分号:extension=php_mbstring.dll;extension=php_mysql.dll,删除前面的分号:extension=php_mysql.dll;extension=php_mysqli.dll,删除前面的分号:extension=php_mysqli.dll;extension=php_pdo_mysql.dll,删除前面的分号:extension=php_pdo_mysql.dll;cgi.force_redirect = 1,删除前面的分号:cgi.force_redirect = 1;cgi.fix_pathinfo=1,删除前面的分号:cgi.fix_pathinfo=1;cgi.rfc2616_headers = 0,删除前面的分号:cgi.rfc2616_headers = 1
三、进入nginx目录创建start_nginx.bat文件(启动nginx服务与php-cgi)
@echo offecho start_nginx.batecho Starting PHP FastCGI...cd G:/php5618 & runhiddenconsole php-cgi.exe -b 127.0.0.1:9000 -c php.iniecho starting nginx...cd G:/nginx181 & start nginx.exeexit
再创建stop_nginx.bat(关闭nginx服务与php-cgi)
@echo offecho stop_nginx.batecho Stopping nginx...taskkill /F /IM nginx.exe > nulecho Stopping PHP FastCGI...taskkill /F /IM php-cgi.exe > nulexit
双击 stop_nginx.bat关闭,双击start_nginx.bat启动
四、打开nginx/conf/nginx.conf文件,配置一个服务
worker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server{ listen 8888; server_name localhost; location / { root G:/www; index index.html index.htm index.php; autoindex on; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME G:/www$fastcgi_script_name; include fastcgi_params; } }}
双击 start_nginx.bat启动服务,ok 正常