nginx环境搭建(windows)
来源:互联网 发布:java从入门到精通第3版 编辑:程序博客网 时间:2024/06/06 09:04
安装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 and exit -V : show version and configure options then exit -t : test configuration and exit -T : test configuration, dump it and exit -q : suppress non-error messages during configuration testing -s signal : send signal to a master process: stop, quit, reopen, reload -p prefix : set prefix path (default: NONE) -c filename : set configuration file (default: conf/nginx.conf) -g directives : set global directives out of configuration file
官网文档命令说明(链接):
nginx/Windows runs as a standard console application (not a service), and it can be managed using the following commands:nginx -s stop fast shutdownnginx -s quit graceful shutdownnginx -s reload changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processesnginx -s reopen re-opening log files
启动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 OFFECHO 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:; index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /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
echo "it works";
然后cmd重启nginx。
浏览器里面打开localhost,看到:
至此nginx+php配置完毕。
0 0
- nginx环境搭建(windows)
- windows搭建Nginx环境
- Nginx- 环境搭建(Windows)
- windows nginx php 环境搭建
- Windows+Mysql+Nginx+PHP环境搭建(wmnp)
- Windows下Nginx+php环境搭建
- windows下搭建nginx+php+redis环境
- windows 下搭建nginx php mysql 环境
- nginx+PHP服务器环境安装与配置学习(一) - windows系统基础环境搭建
- windows 下 laragon(用nginx+php7+mariadb) 集成环境,搭建 laravel 5.3
- Windows环境下用jwplayer+Nginx搭建视频点播服务器
- Windows环境下用jwplayer+Nginx搭建视频点播服务器
- Windows下nginx+php+eclipse开发环境搭建。
- Windows下nginx+php+eclipse开发环境搭建
- 在Windows环境下搭建Nginx文件服务器(简单实用版)
- (转)wnmp(windows+nginx+mysql+php)环境搭建和配置
- 如何在windows下搭建Nginx+MySQL+PHP环境
- wnmp(windows+nginx+mysql+php)环境搭建和配置
- 从上往下打印二叉树
- Handlebars的if用法和@index用法
- CentOS7.x 修改主机名
- spring 和 quartz 整合版本兼容性问题
- Test class requires enabled assertions, enable globally (-ea) or for Solr/Lucene sub
- nginx环境搭建(windows)
- 算法竞赛入门经典(第2版)习题2-1详解
- android:ToolBar详解(手把手教程)
- windows下安装qt
- Swift 3.0开发者预览版(第一版)发布内容简介
- oracle sql基础练习随笔
- Docker的安装,包括内核的升级(centos6内核太低需要升级到3.1以上)
- 自定义横向日期选择器,可滑动,可点击
- Linux环境JDK安装详解