Mac Apache

作者: 某个胖子 | 来源:发表于2017-02-20 22:53 被阅读138次

    Apache官网
    Mac上默认安装Apache

    • 启动
      sudo apachectl -k start
    • 重启
      sudo apachectl -k restart
    • 关闭
      sudo apachectl stop

    设置Apache默认目录

    • 进入Apache配置文件所在目录: ** cd /etc/apache2/**
    • 修改Apache配置文件,需要root:sudo vi httpd.conf
    • 查找DocumentRoot字符串,“/” 为定位查找:/DocumentRoot
    • 将DocumentRoot对应的值,修改为自己想要的目录即可。
    • 重新启动Apache

    在使用过程中遇到

    • 问题一:
    bogon.png

    解决办法:在系统的hosts(/etc/hosts)文件中添加 127.0.0.1 bogon

    • 问题二:
    conf.png

    解决办法:在Apache配置文件(/etc/apache2/httpd.conf)中设置 ServerName 127.0.0.1

    • 问题三:

    You don't have permission to access / on this server.##

    解决办法:
    1、检查Apache配置文件(/etc/apache2/httpd.conf)中的设置
    2、在目录下指定目录下添加index.html文件

    • 问题四:

    无法访问根目录下的子目录##

    解决办法:将根目录的options设置为 Options Indexes FollowSymLinks Multiviews

    相关文章

      网友评论

        本文标题:Mac Apache

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