绿色版Apache + PHP的环境搭建
1. httpd.exe -k install
D:\DevelopPlatform\Apache24X86\bin>httpd.exe -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
httpd.exe: Syntax error on line 37 of D:/DevelopPlatform/Apache24X86/conf/httpd.
conf: ServerRoot must be a valid directory
修正错误:
进入httpd.conf, 设置ServerRoot:(apache安装目录)
示例:ServerRoot "D:/DevelopPlatform/Apache24X86"
1.1. httpd.exe -k uninstall
Removing the 'Apache2.4' service
The 'Apache2.4' service has been removed successfully.
2. httpd.exe -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
AH00526: Syntax error on line 244 of D:/DevelopPlatform/Apache24X86/conf/httpd.c
onf:
DocumentRoot must be a directory
修正错误:
进入httpd.conf, DocumentRoot:(apache htdocs目录)
示例:DocumentRoot "D:\DevelopPlatform\Apache24X86\htdocs"
2.1. httpd.exe -k uninstall
Removing the 'Apache2.4' service
The 'Apache2.4' service has been removed successfully.
3. httpd.exe -k install
Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
4.
至此, apache已经安装完毕,
然后配置一下apache
进入httpd.conf
找到
Listen 80改为8080(将监听端口改为8080,防止80端口被占用出错)
开启ServerName
改为ServerName localhost:8080
重新启动下apache, 进入浏览器输入: localhost:8080/index.html 进行访问
这时有可能发生错误, 网页会输出如下内容:
You don't have permission to access /index.html on this server.
我的解决办法是进入httpd.conf
在DocumentRoot "D:\DevelopPlatform\Apache24X86\htdocs"下一行的
找到
推荐阅读
-
利用docker搭建php7和nginx运行环境全过程(官方镜像)
-
Centos服务器上NFS灾备环境及KVM的搭建及使用
-
单台服务器中利用Apache的VirtualHost如何搭建多个Web站点详解
-
Ubuntu服务器下搭建php运行环境的方法
-
Centos7.3服务器搭建LNMP环境的方法
-
Ubuntu14.04服务器环境下配置PHP7.0+Apache2+Mysql5.7的方法
-
配置Apache2.2+PHP5+CakePHP1.2+MySQL5运行环境
-
Linux下的Apache与PHP安全设置技巧
-
在Windows的Apache服务器上配置对PHP和CGI的支持
-
CentOS 6.5中利用yum搭建LNMP环境的步骤详解