您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

nginx环境搭建(windows)

2025/12/5 18:35:55发布35次查看
安装nginx
下载nginx(官网)
本次下载的是:nginx/windows-1.10.1(mainline version)
然后将zip包解压,放到指定目录。
cmd查看nginx -h 命令
d:\nginx-1.11.1>nginx.exe -hnginx version: nginx/1.11.1usage: nginx [-?hvvttq] [-s signal] [-c filename] [-p prefix] [-g directives]options: -?,-h : this help -v : show version andexit -v : show version and configure options thenexit -t : test configurationandexit -t : test configuration, dump it andexit -q : suppress non-error messages during configuration testing -s signal : send signalto a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: none) -c filename : set configurationfile (default: conf/nginx.conf) -g directives : set global directives outofconfigurationfile
官网文档命令说明(链接):
nginx/windows runs asa standard console application (nota service), andit can be managed usingthe following commands:nginx -s stop fast shutdownnginx -s quit graceful shutdownnginx -s reload changing configuration, starting new worker processes withanew configuration, graceful shutdown of old worker processesnginx -s reopen re-opening logfiles
启动nginx:d:\nginx-1.11.1>start nginx.exe
然后打开浏览器输入localhost,可以看到如下:
至此,nginx在windows上面就安装完毕了。
配置php的fast-cgi
官方教程(链接)
下载runhiddenconsole,并放置在指定目录,例如c:\bin。
建立bat文件:start-php-fcgi.bat。文件内容如下(php-cgi.exe目录需配置):
@echo off
echo starting php fastcgi...
set path=c:\php;%path%
c:\bin\runhiddenconsole.exe c:\php\php-cgi.exe -b 127.0.0.1:9123
启动start-php-fcgi.bat文件。
配置nginx文件:nginx.conf。
修改server配置:
server { listen 80; server_name localhost; root e:; #charset koi8-r;#access_log logs/host.access.log main; location / { #root e:;indexindex.html index.htm index.php; } #error_page 404 /404.html;# redirect server error pages to the static page /50x.html# error_page 500502503504 /50x.html; location = /50x.html { 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 e:; fastcgi_pass 127.0.0.1:9123; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name;#/scripts$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;#} }
在root目录建立index.php
echoit works;
然后cmd重启nginx。
浏览器里面打开localhost,看到:
至此nginx+php配置完毕。
').addclass('pre-numbering').hide(); $(this).addclass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadein(1700); }); }); 以上就介绍了 nginx环境搭建(windows),包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product