os mac apache+php+mysql环境配置

1。启用系统自带的apache 服务

打开终端(terminal)

#sudo apachectl start

#sudo vi /etc/apache2/httpd.conf

修改

LoadModule php5_module libexec/apache2/libphp5.so

//开启php

/*****如果访问403****/

<Directory />

AllowOverride none

Order allow,deny

Allow from all

#   Require all denied

Require all granted

</Directory>

/****修改Require all granted*****/

Include /Volumes/App/webserver/vhosts/*.conf

引入虚拟主机的文件。

#wq  //保存退出

#vi /Volumes/App/webserver/vhosts/sv1.conf

<VirtualHost *:80>

ServerAdmin www.sv1.com

DocumentRoot "/Volumes/App/webserver/wwwroot/sv1/wwwroot"

ServerName www.sv1.com

ErrorLog "/Volumes/App/webserver/log/apache2/sv1-error_log"

CustomLog "/Volumes/App/webserver/log/apache2/sv1-access_log" common

</VirtualHost>

#sudo vi /etc/hosts

#sudo apachectl restart   //重启

2。mysql

添加brew

参考:http://brew.sh/index_zh-cn.html

打开终端窗口, 粘贴以上脚本。

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$brew install mysql
$unset TMPDIR
$mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/Volumes/App/webserver/mysqldata --tmpdir=/tmp/
$mysql.server start
$mysqladmin -u root password 'newpassword'

拷贝:/usr/local/var/mysql/下的文件到   /Volumes/App/webserver/mysqldata

修改/usr/local/Cellar/mysql/5.6.10/homebrew.mxcl.mysql.plist

<string>--datadir=/Volumes/App/webserver/mysqldata</string>

数据库目录文件位置。

$sudo cp /usr/local/Cellar/mysql/5.6./homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
$launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

/*  ~ 标记为当前用户目录 */

http://mac.pcbeta.com/thread-138241-1-1.html

上一篇:iOS - Mac Apache WebDav 服务器配置


下一篇:Mac Apache WebDav 服务器配置