将需要添加的.conf文件加入/usr/local/etc/nginx/servers/
路径
//xxx.conf
server {
listen 80;
server_name laravel.cc;
set $htdocs /Users/xxx/xxx;
location / {
root $htdocs;
index index.php index.html;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php(.*)$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $htdocs$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
}
}
再进入 /etc/hosts
添加 127.0.0.1 laravel.cc
保存重启nginx
即可