Home  >  Q&A  >  body text

macos - Virtual host configuration problem of nginx under mac

1. Configure ngnix virtual host on mac. The core configuration is as follows:

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;

        include        fastcgi_params;
   }

After configuration, "File not found" appears. . . . The files and everything exist and the permissions are there. . .
Finally, I didn’t change the directory for a long time. I changed root /Users/yangbai/Desktop/xxx; to root /Library/WebServer/Documents/xxx; and moved the website to It can be accessed under the default webserver directory of mac. It seems that it is a permission issue under mac. I wonder if you have encountered it before?

伊谢尔伦伊谢尔伦2713 days ago604

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:20:43

    This is owned by the user you ngnix的运行用户以及你当前用户的权限有关。你看到的文件夹的权限是你当前用户的,并不代表ngnixrun. If there are no other security considerations, you can change the permissions of the directory where the program is located to 777, which will save a lot of trouble.

    reply
    0
  • Cancelreply