- 找到nginx默认的配置文件
/usr/local/etc/nginx/nginx.conf
- 修改root,改成自己项目的路径
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 50M;
server {
listen 80;
server_name localhost;
root 指向要访问的项目文件路径;
location / {
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
include servers/*;
}
- 重启nginx
brew services restart nginx
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END