apache--mac上apache配置

-推荐一篇文章

  1. 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配置

参考王宝龙简书-Apache、Nginx配置虚拟主机

第一步 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文件就是站点配置文件
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容