MAC + XMAPP下配置虚拟主机

MAC + XMAPP下配置虚拟主机

标签(空格分隔): PHP


在mac下配置PHP开发环境

在mac下配置PHP开发环境参考文章

在XMAPP中配置虚拟主机

  • 1.打开/etc/hosts,添加主机地址如下
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 

// 添加的虚拟主机
127.0.0.1   www.39.com
  • 2.修改httpd.conf文件,目录是/Applications/XAMPP/xamppfiles/etc/httpd.conf。搜索httpd-vhosts.conf取消最前面的#,确保引入了vhosts虚拟主机配置文件

  • 3.再在httpd.conf的最后面添加一段一下代码


        #Options Indexes FollowSymLinks ExecCGI Includes #don't permission see list
        Options All
        AllowOverride All
        Order allow,deny
        Allow from all

说明:
“Options All”是允许目录浏览,有安全性风险,适合用于个人调试程序,需注意当站点根目录含index.html页面时,会默认打开网页,而不是目录列表,因此此模式需删除index.html.
“Options Indexes FollowSymLinks ExecCGI Includes”是不允许目录浏览,适合正式站点

    1. 打开文件httpd-vhosts.conf文件,目录是/Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf

    ServerAdmin [email protected]
    DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host.example.com"
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog "logs/dummy-host.example.com-error_log"
    CustomLog "logs/dummy-host.example.com-access_log" common



    ServerAdmin [email protected]
    DocumentRoot "/Applications/XAMPP/xamppfiles/docs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common



    ServerAdmin [email protected]
    DocumentRoot "/Users/yuanjunliang/Documents/www/www.39.com"
    ServerName www.39.com
    ErrorLog "logs/dummy-host2.example.com-error_log"
    CustomLog "logs/dummy-host2.example.com-access_log" common

编辑完然后在浏览器中输入www.39.com即可看到配置好的网站

你可能感兴趣的:(MAC + XMAPP下配置虚拟主机)