美文网首页
mac apche 多站点踩坑

mac apche 多站点踩坑

作者: 路路有话说 | 来源:发表于2020-05-11 13:11 被阅读0次

mac 重装系统之后,之前配置过得多站点apache 无法使用了
这里记录一下

系统版本 macOS Catalina 10.15.4

使用到的命令

#重启apache 服务
sudo apachectl restart
#检查apache 的服务
httpd -S  

httpd -S会抛出一些异常可以检测是否配置成功

详细报错

配置过程

需要配置的有三个文件 httpd.conf、httpd-vhost.conf以及 host文件
对应路径
httpd.conf => /private/etc/apache2/httpd.conf
httpd-vhost.conf => /private/etc/apache2/extra/httpd-vhost.conf
host => /etc/host

在host 中添加上

127.0.0.1 site.lueluelue.net
127.0.0.1 yii.lueluelue.net

httpd.conf 中

#大概在255 行左右
DocumentRoot "/Users/lueluelue/webstation"
<Directory "/Users/lueluelue/webstation">
# 前面的   -> # <- 去掉
Include /private/etc/apache2/extra/httpd-vhosts.conf

这里解释一下 DocumentRoot 指的是你网站访问的根目录,(这里一开始没有做修改导致了一直403)
httpd-vhost.conf 配置如下


<VirtualHost *:80>
   ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/Users/lueluelue/webstation/site"
    ServerName site.lueluelue.net
    ErrorLog "/Users/lueluelue/webstation/logs/site--error_log"
    CustomLog "/Users/lueluelue/webstation/logs/site-access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/Users/lueluelue/webstation/yiisite"
    ServerName yii.lueluelue.net
    ErrorLog "/Users/lueluelue/webstation/logs/yii-error_log"
    CustomLog "/Users/lueluelue/webstation/logs/yii--access_log" common
</VirtualHost>

需要注意的是 在httpd-vhost.conf 中配置的 DocumentRoot需要在
httpd.conf配置的DocumentRoot之下,否者会出现403


另外也有说法 把user 修改为你的用户名


划线部分就是用户名
#199行左右
User _www
#修改为
User aleenlee

ServerName 的问题


image.png
#230行
#ServerName www.example.com:80
ServerName localhost

最后都希望大家配置成功

我是小菜鸡,我喂自己袋盐

相关文章

  • mac apche 多站点踩坑

    mac 重装系统之后,之前配置过得多站点apache 无法使用了这里记录一下 系统版本 macOS Catalin...

  • Apche2多站点配置

    1. 修改Apache配置文件 打开Apache的配置文件,/etc/apache2/sites-enabled/...

  • Windows下GithubPages博客快速搭建

    Windows下开发坑总是比较多的,但是本人没Mac,只好踩一遍坑记录下。本文主要是安装过程&踩坑记录,故不对细节...

  • Mac 搭建GLFW

    # Mac搭建GLFW踩坑(10.14): ## 正常流程: https://www.jianshu.com/p/...

  • Python笔记

    最近在学习python,记点坑,免得以后又踩~ 哦,对了,我用的mac,所以这里只做mac坑的记录,win...

  • Centos 7 搭建jira 7.3

    1、Mac、jira最新版: 之前在自己的mac上尝试了搭建jira: 传送门: 【踩坑】Mac搭建jira(数据...

  • 宿主机登陆 VirtualBox CentOS7 的 SSH

    说下我我踩的坑,而且还是个很深的坑!!! 软件&环境 宿主机 Mac macos Mojave 版本10.145 ...

  • Retrofit Https踩坑记录

    Retrofit Https踩坑记录 前言 新司机上路,坑多,本文重点是踩坑,不详细讲retrofit用法,本文不...

  • 随笔

    读书啊,就是一个坑踩完了又掉进另一个坑,先说踩读书没用的坑,爬出来了,再踩读书要多的坑,之后再踩读书要精啊,读书要...

  • mac配置踩坑

    之前一直没有发现,mac下配置bash_profile还有这样的一个坑。 刚才学习flume,vi ~/.ba...

网友评论

      本文标题:mac apche 多站点踩坑

      本文链接:https://www.haomeiwen.com/subject/vbcunhtx.html