1、mysql
加入环境变量
☁ ~ sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql
2、apache
加入环境变量
☁ ~ sudo ln -s /Applications/MAMP/Library/bin/httpd /usr/local/bin/httpd
3、php
加入环境变量
☁ ~ vim ~/.bash_profile
source ~/.profile
export PATH="/Applications/MAMP/bin/php/php7.0.27/bin:$PATH";
保存
☁ ~ source ~/.bash_profile
但是这样一般没什么用,过一会儿又变回来了,而且使用php时都是在iTerm中,所以配置iTerm就成
☁ ~ vim ~/.zshrc
export PATH="/Applications/MAMP/bin/php/php7.0.27/bin:$PATH"
#export PATH="/Applications/MAMP/bin/php/php5.6.32/bin:$PATH"
☁ ~ which php
/Applications/MAMP/bin/php/php7.0.27/bin/php
4、nginx
配置
当对nginx进行配置时,会在
/Library/Application Support/appsolute/MAMP PRO/conf
下生成nginx.conf
,同理apache和php也是如此
修改location / { }
时,只需要如图添加配置即可
location / {
try_files try_files $uri $uri/ /index.php?$query_string;
index index.html index.php;
}
添加以下配置只需要填入Additional parameters for <server> directive*
一栏就ok
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
网友评论