nginx配置信息
server {
listen 8081;
server_name localhost;
root /Volumes/New/phpmyadmin;
index index.html index.htm index.php;
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;
}
}
server {
listen 9090;
server_name localhost;
root /Volumes/New/mycode/xxxx/public;
try_files $uri $uri/ /index.php?$args;
index index.html index.htm index.php;
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;
}
}
重新启动nginx
brew services restart nginx
查看nginx配置所在位置的命令
$ nginx -t
admin@gz servers % nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
admin@gz servers %
本文详细介绍了两个Nginx配置文件,分别监听8081和9090端口,服务于不同的目录路径。配置中包含PHP处理设置,通过fastcgi_pass连接本地PHP服务。此外,还展示了如何使用`brew services restart nginx`命令重启Nginx,以及通过`nginx -t`检查配置文件的语法和成功性。
946

被折叠的 条评论
为什么被折叠?



