-推荐一篇文章
- apache重启失败
AH00557: apache2: apr_sockaddr_info_get() failed for ubuntu
AH00558: apache2: Could not reliably determine the server's fully
qualified domain name, using 127.0.0.1. Set the 'ServerName' directive
globally to suppress this message
解决办法,vi /etc/apache2/apache2.conf ,在最后一行加上 ServerName localhost:80
很多时候会出现权限问题或者站点配置不成功,为此专门测试写了此文
mac上apache
配置
第一步
vi /etc/apache2/httpd.conf
寻找apache2配置文件,httpd.conf或者依据版本不同的其他配置文件;找到后打开vhost 模块,rewrite模块(就是将前面“#”号给去除),并引入vhost配置文件。
vhost 模块
rewrite模块
第二部
vi /etc/apache/extra/httpd-vhosts.conf
写入如下代码
<VirtualHost *:80>
ServerName wbl.demo
DocumentRoot /home/wangbaolong/workspace/
<Directory "/home/wangbaolong/workspace/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow From All
Require all granted
</Directory>
</VirtualHost>
httpd-vhost原样
- 或者在
vi /etc/apache2/httpd.conf
里面修改如下。但是还是推荐第一种方式
image.png
很多时候我们找不到站点配置文件,以下是寻找方式
1.apachectl -V
显示中会有
2.SERVER_CONFIG_FILE="/usr/local/etc/httpd/httpd.conf"
3.vi /usr/local/etc/httpd/httpd.conf
在3文件中找到下面这行
4 Include /usr/local/etc/apache2/2.4/extra/httpd-vhosts.conf
这个httpd-vhosts.conf文件就是站点配置文件