Nginx+PHP On windows

本文解决了Nginx在Windows环境下启动失败的问题,错误信息显示无法打开错误日志文件及找不到配置文件。通过调整配置文件中的路径设置或确保在Nginx安装目录下启动服务器来解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前期准备

Nginx 下载

http://nginx.org/

 

PHP下载

PHP Windows binaries

 

 

 

问题

问题1:

opened a DOS window to launch the nignx server, and got the following errors:
D:\Users\phil>c:\nginx\nginx.exe
nginx: [alert] could not open error log file: CreateFile() "logs/error.log" failed (3: FormatMessage() error:(15100))
2014/04/03 11:30:01 [emerg] 2356#6140: CreateFile() "D:\Users\phil/conf/nginx.conf" failed (3: FormatMessage() error:(15105))
D:\Users\phil>

问题解决:

显然是默认相对路径不认,去修改nginx.conf文件,调整access_log的路径地址,如下;

或者

在windows下启动nginx要在命令行里进入nginx.exe的那个目录里,否则会提示不能创建日志文件(不能简单的改写环境变量)

 

参考

如何正确配置Nginx+PHP

nginx + PHP on Windows in 5 minutes

转载于:https://www.cnblogs.com/HQFZ/p/4958022.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值