如果启动时出现:The requested operation has failed! 提示,请打开:apache24/conf/httpd.conf,找到这一行:Define SRVROOT “/apache”,改为正确的路径:Define SRVROOT “C:\apache”
接下来配置域名,找到:C:/apache/conf/httpd.conf,可以记事本形式打开,这里建议安装Notepad++,小巧高效的编辑器,方便查看修改代码,在末尾处换行添加如下代码:
<VirtualHost *:80>
ServerAdmin test@163.com
DocumentRoot c:/fjxmseo
ServerName fjxmseo.cn
ServerAlias www.fjxmseo.cn
#这里配置欢迎首页面
DirectoryIndex index.php index.html index.htm
<Directory “c:/fjxmseo“>
Options Indexes FollowSymLinks
#不容许别人修改我们的页面
AllowOverride None
#设置访问权限
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
显红处替换成你站点的信息,邮箱、路径、域名。然后保存,重启服务,这时如果出现错误,提示:the requested operation has failed!并无法启动,可以检查80端口是否被占用,打开CMD,在命令行使用 netstat -aon|findstr “80”,或者命令行内进入安装目录Apache\bin,使用命令:httpd -t,看出现什么样的错误提示。
接下来输入域名访问,会出现:外网访问403(Forbidden)错误,仍然是打开httpd.conf文件,找到:
<Directory />
AllowOverride none
Require all denied
</Directory>
修改为:
<Directory />
AllowOverride none
#Require all denied
Require all granted
</Directory>
然后重启服务访问域名会出现php代码,这是PHP无法解析直接显示了源代码,打开httpd.conf文件,在末尾处换行粘贴下面代码:
#php5_start
phpIniDir “c:/websoft/php“
LoadModule php5_module “c:/websoft/php/5.2/php5apache2_4.dll“
#php5_end
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
然后重启服务,红色部份是PHP安装的路径,请自行替换,到这里,域名就绑定成功了,网站也可以正常访问。