Mac XAMPP 多域名虚拟主机配置

2016-11-30  本文已影响0人  kangqiao182

[TOC]

一. 安装最新版本的XAMPP

下载地址: https://www.apachefriends.org/zh_cn/download.html
当前最新版本: 7.0.13 / PHP 7.0.13

安装成功后打开安装目录: /Applications/XAMPP/

xampp程序目录.png
yourMac:~ �yourName$ sudo apachectl stop

二. 配置XAMPP

2.1 配置ProFTPD
warning: unable to determine IP address of 'XxxxXxx'
error: no valid servers configured
Fatal: error processing configuration file '/etc/proftpd.conf'
2.2 配置/Applications/XAMPP/etc/httpd.conf
1> 更改基础配置
User �yourName
ServerAdmin kangqiao610@gmail.com

# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
2> 配置你的本地站点目录

在httpd.conf最后加入:

<Directory "/Users/yourName/workspace/web">
    #Options Indexes FollowSymLinks ExecCGI Includes #don't permission see list
    Options All
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
2.3 配置/Applications/XAMPP/etc/extra/httpd-vhosts.conf
1> 注释掉默认的空主机示例配置
##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host.example.com
##    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
##</VirtualHost>
##
##<VirtualHost *:80>
##    ServerAdmin webmaster@dummy-host2.example.com
##    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
##</VirtualHost>
2> 增加XAMPP管理界面主机配置
#### XAMPP 集成环境管理站点 /Applications/XAMPP/xamppfiles/htdocs
<VirtualHost *:80>
    ServerAdmin kangqiao610@gmail.com
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    ServerName xampp.com
    ServerAlias xampp
    ErrorLog "logs/xampp_error.log"
    CustomLog "logs/xampp_access.log" common
</VirtualHost>
3> 增加自己本地站点的主机配置
###########测试初始配置
<VirtualHost *:80>
        ServerAdmin kangqiao610@gmail.com
        DocumentRoot "/Users/yourName/workspace/web/mySite"
        ServerName my.com
        ErrorLog "/Users/yourName/workspace/web/logs/my_error.log"
        CustomLog "/Users/yourName/workspace/web/logs/my_access.log" common
        <Location />
            AllowOverride all
            Require all granted
        </Location>
</VirtualHost>

三. 配置/etc/hosts

#xampp manager site:
127.0.0.1       xampp.com
#myself sites:
127.0.0.1       my.com
127.0.0.1       wordpress.com```

* 测试下你的配置
在浏览器中打开localhost 或 xampp.com 会默认打开XAMPP的引导页
![xampp默认引导页.png](https://img.haomeiwen.com/i1976768/88af3a40248e6f96.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

####四. 设置mysql密码
#####4.1 更改mysql密码
点击XAMPP引导页面的phpmyadmin管理界面
![phpmyadmin修改pndc.png](https://img.haomeiwen.com/i1976768/45584efac6cbca2c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
注意: 不要点生成密码
具体参见http://jingyan.baidu.com/article/e4511cf332b9832b845eaf27.html
#####4.2 配置phpmyadmin新密码
打开/Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php
找到
$cfg['Servers'][$i]['password'] = '';
改为
$cfg['Servers'][$i]['password'] = 'root'; 
保存退出后,重启xampp即可。

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';


######参考
http://blog.sina.com.cn/s/blog_48e0ae280101hquv.html
http://www.deepvps.com/proftpd-failed-to-start.html
http://www.cnblogs.com/heiniuhaha/archive/2011/10/14/2212478.html
上一篇下一篇

猜你喜欢

热点阅读