httpd主配置文件/usr/local/apache2.4/conf/httpd.conf vim /usr/local/apache2.4/conf/httpd.conf //修改以下4个地方 ServerName(前面#去掉) Require all denied //改成Require all granted(防止打开虚拟主机配置文件时显示403) AddType application/x-httpd-php .php //解析php DirectoryIndex index.html index.php /usr/local/apache2.4/bin/apachectl -t //测试语法 /usr/local/apache2/bin/apachectl graceful 重新加载配置文件,不会把进程杀掉 /usr/local/apache2.4/bin/apachectl start //启动服务 netstat -lntp curl localhost vim /usr/local/apache2.4/htodcs/test.php //增加如下内容 <?php Phpinfo(); ?>

问题!!

  1. /usr/local/apache2.4/bin/apachectl restart AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message 解决办法: vi conf/httpd.conf #ServerName www.example.com:80 //这个打开