2022-03-05 581
windows下配置NGINX+PHP+MYSQL环境
nginx官网下载:http://nginx.org/en/download.html
php官网下载:https://windows.php.net/downloads/releases/archives/
Mysql官网下载:https://downloads.mysql.com/archives/installer/
这里我准备的是nginx1.18+php5.5+mysql5.6
1.安装nginx(参考http://www.77isp.com/post/15.html)
解压nginx-1.18.0.zip到C盘下如:c:/nginx
打开c:/nginx目录,双击运行nginx.exe
测试nginx是否正常,浏览器访问http://localhost 或 http://127.0.0.1看是不是显示出nginx默认页
配置nginx启动php
打开nginx配置文件,默认为:C:\nginx\conf\nginx.conf文件
第一处修改大概在43-46行左右
location / { root html; index index.html index.htm; }
修改为:
location / { root c:/web; index index.html index.htm index.php; }
注:c:/web即网站目录;添加index.php的默认页。
设置php的支持
第二处修改大概在65-71行左右
#location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #}
修改为
location ~ \.php$ { root c:/web; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME c:/web/$fastcgi_script_name; include fastcgi_params; }
2.解压php到C盘下如:c:/php(参考1-4部分http://www.77isp.com/post/219.html)
安装并配置php
C:/php下复制php.ini-development文件,并将文件名改为php.ini,修改php配置文件php.ini,保存即可。
第718行 ; extension_dir = "ext" 先去前面的分号再改为 extension_dir = "D:\php\ext"
第910行 ;date.timezone = 先去前面的分号再改为 date.timezone = Asia/Shanghai
第728行enable_dl = Off 改为 enable_dl = On
第735行 ;cgi.force_redirect = 1 先去前面的分号再改为 cgi.force_redirect = 0
第763行 ;fastcgi.impersonate = 1 去掉前面的分号
第775行 ;cgi.rfc2616_headers = 0 先去前面的分号再改为 cgi.rfc2616_headers = 1
需要什么扩展对应的分号去掉即可
注:每个版本的行数基本上都不一致,如对应行数找不到可以直接搜索关键字来修改
运行php
c:\php\php-cgi.exe -b 127.0.0.1:9000 -c c:\php\php.ini
在我们网站目录下新建一个index.php,内容如下
<?php phpinfo();?>
然后访问:http://127.0.0.1/index.php
显示如下页面则配置正常
3.安装MySQL参考(http://124.222.111.252:8885/post/86.html)http://www.77isp.com/post/222.html
原文链接:http://www.77isp.com/post/223.html
=========================================
http://www.77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2023-01-07
网站技术 2022-11-17
网站技术 2022-11-26
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
数据库技术 2022-02-20
Linux相关 2022-02-27
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态