Mac下XAMPP本地多站点配置

2017-12-26  本文已影响0人  antelop

涉及的配置文件:hosts,httpd.conf,httpd-vhosts.conf

1. hosts文件添加自定义域名,sudo nano /etc/hosts

修改完后,control+x保存退出

2. httpd-conf配置,打开配置文件所在目录 open /Applications/XAMPP/xamppfiles/etc

使用编辑器打开httpd.conf,找到httpd-vhosts.conf,删除前面的“#”号,在末尾添加

<Directory "/Applications/XAMPP">

#Options Indexes FollowSymLinks ExecCGI Includes #don't permission see list

Options All 

AllowOverride All

Order allow,deny

Allow from all

</Directory>

Options:控制哪些服务器特性 

    All:用户可以在此目录做任何操作

    None:不允许访问此目录

    Indexes:是否显示文件列表

Allow:允许哪个版本可以访问

Deny:禁止哪些主机访问

Order:控制Deny和Allow生效顺序

AllowOverride:根据All和None的值来决定是否读取.htaccess文件中的信息来改变原配置

.htaccess控制相关目录下的配置

3. httpd-vhosts.conf配置,open /Applications/XAMPP/xamppfiles/etc/extra

编辑器打开httpd-vhosts.conf,在末尾添加

完成后重启apache即可。

4. 如果出现错误:xampp:Access forbidden!You don't have permission to access the requested directory,修改httpd-vhosts.conf文件

<Directory />

        Options All

        AllowOverride All 

        Order deny,allow 

        Allow from all 

    Require all granted 

</Directory>

参考:

https://www.cnblogs.com/heiniuhaha/archive/2011/10/14/2212478.html

http://blog.csdn.net/wj610671226/article/details/64513919

上一篇 下一篇

猜你喜欢

热点阅读