FastAdmin踩坑记, 搭建一个简单的后台居然花了我三个多小时!!!
写在前面
本地开发请尽量不用代理!!!
Mac下搭建开发环境,只能访问localhost
,找了各种问题,最后发现是翻墙的原因!
MAMP PRO 配置伪静态这个大坑!!!
使用MAMP PRO
搭建好FastAdmin
后只能访问首页,无法访问别的。
Apache
Nginx
开始找解决办法
首先找 Nginx(nginx.conf)
/Applications/MAMP/conf/nginx/nginx.conf
哗哗的将这段代码复制到nginx.conf
中,跑起来,尼玛,为啥还是404!
看了下官网。。。
Use Nginx as a Reverse Proxy for Apache
Check to use Nginx as a reverse proxy for Apache. When this option is checked the following will be added to your
/Library/Application Support/appsolute/MAMP PRO/conf/nginx.conf
file. Your requests will now be forwarded to your Apache server localhost.
https://documentation.mamp.info/en/MAMP-PRO-Mac/Servers-and-Services/Nginx/
哗哗的将这段代码复制到上面的nginx.conf
中,跑起来,尼玛,为啥还是404!
多次尝试无果,在一篇博客上看到
https://documentation.mamp.info/en/MAMP-PRO-Mac/Menu/File/
MAMP PRO uses templates to create the necessary server config files. You can edit these templates from the menu itemFile > Edit Template
. Here, you have access to options which are not accessible from the MAMP PRO user interface.
可怕!
打开File/Edit Template/Nginx(nginx.conf)
,加入以下代码:
1 | location / { |
这个大坑终于得到解决~