win32下安装nginx和配置php,win32nginx配置php
win32下安装nginx和配置php,win32nginx配置php
/*+------------------------------------windows下NGINX------------------------------------+*/
启动:start c:\nginx\nginx
停止:c:\nginx\nginx -s stop
关闭进程:taskkill /F /IM nginx.exe > nul
/*+------------------------------------nginx.conf配置说明------------------------------------+*/
worker_processes 1;
error_log logs/error.log; //错误日志存放路径
events { //开启线程数
worker_connections 64;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80; //监听端口
server_name localhost; //服务器名称
charset utf-8; //默认编码
location / {
root e:\www; //文件存放路径
index index.html index.htm index.php;
autoindex on; //如果文件不存在,列出目录结构
}
error_page 500 502 503 504 /50x.html; //这些错误代码,转向/50x.html
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000; //重要:fastcgi及监听端口,与php的cgi启动一定要一至
fastcgi_index index.php; //默认首页
fastcgi_param SCRIPT_FILENAME e:\www$fastcgi_script_name; //启动路径
include fastcgi_params;
}
}
}
/*+------------------------------------使用php fastcgi模式启动------------------------------------+*/
启动php:php-cgi.exe -b 127.0.0.1:9000 注意,启动的端口号要和nginx的端口号一至
评论暂时关闭