访问排行榜
谷歌广告
谷歌广告
Mac使用MAMP时,简单的环境配置
Author 沐青之枫 | Posted 2018-03-13 16:00:00

转载地址:www.jianshu.com/p/8fd5e1e5c619

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<br />

但是这样一般没什么用,过一会儿又变回来了,而且使用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 / { }时,只需要如图添加配置即可

image.png

 location / {
            try_files       try_files $uri $uri/ /index.php?$query_string;
            index           index.html index.php;
 }

添加以下配置只需要填入Additional parameters for directive一栏就ok

image.png
 location ~ .</em>.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

Android+GoLang+SprintBoot探讨群:186305789(疯狂的程序员),绝影大神在等你

个人兴趣网站:zero接码平台

个人兴趣网站:猿指


Comments

comments powered by zero