macos - mac下nginx的虚拟主机配置问题

【字号: 日期:2022-07-15浏览:47作者:雯心

问题描述

1、在mac进行ngnix的虚拟主机配置,核心配置如下:

listen 8888; server_name xxxx.com; root /Users/yangbai/Desktop/xxx; index index.php; location / {}location ~ .php$ {#root /Users/yangbai/Desktop/xxx;fastcgi_pass 127.0.0.1:9001;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;#fastcgi_buffer_size 128k;#fastcgi_buffers 8 128k;fastcgi_ignore_client_abort on;includefastcgi_params; }

配置好之后,出现“File not found”。。。。文件什么的都存在,权限也有。。。最后搞了半天不换目录了,把root /Users/yangbai/Desktop/xxx; 改成root /Library/WebServer/Documents/xxx;网站移动到mac默认的webserver目录下面就可以访问了,感觉是mac下权限的问题,不知道各位有没有碰到过呢?

问题解答

回答1:

这和你ngnix的运行用户以及你当前用户的权限有关。你看到的文件夹的权限是你当前用户的,并不代表ngnix运行用户所拥有的。如果没有其他安全考虑,可以把程序所在目录的权限改为777,这样省去很多麻烦。

相关文章: