Blog | Phodal - A Growth Engineerhttp://www.phodal.com/blog/2015-04-13T08:46:38.617636+00:00BlogMac OS PHP MySQL Nginx环境搭建2014-08-02T04:43:32+00:002015-04-13T08:46:38.617636+00:00Phodal Huanghttp://www.phodal.com/blog/author/root/http://www.phodal.com/blog/mac-os-setup-mysql-nginx-php/为了修改一下[寻ta驿站](http://www.xuntayizhan.com)的主题,需要在本地set up一个Wordpress的环境。分享一下Mac OS上安装Wordpress的过程:
##Mac OS 安装php及php-fpm
在这里是用brew来安装包的
1.看看是否已经有了php的repo
brew search php
2.Setup下依赖
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
3.安装php及php-fpm
brew install php55 --with-fpm --with-imap --without-apache --with-debug
4.添加开机启动
ln -s /usr/local/opt/php55/homebrew.mxcl.php55.plist ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
5.运行php-fpm
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
##Mac OS安装Nginx
1.安装nginx
brew install nginx
2.添加Nginx开机启动
ln -s /usr/local/opt/php55/homebrew.mxcl.nginx.plist ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
3.启动Nginx
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
##Mac OS安装MySQL
1.安装MySQL
brew install mysql
2.添加MySQL开机启动
ln -s /usr/local/opt/php55/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
3.启动MySQL
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
##配置Nginx
默认的80端口只有root用户才能用,于是我们需要修改端口为8080。安装完Nginx后,会有这样的提示
修改端口
vim /usr/local/etc/nginx/nginx.conf
修改了默认的文档路径,部分配置如下
server {
client_max_body_size 20M;
listen 8080;
server_name localhost;
root /Users/fdhuang/www;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /Users/fdhuang/www;
index index.html index.htm index.php;
}