I installed nginx through brew, and the previous steps were successful,
Common nginx commands:
Nginx-s stop/quit/reopen/reload
Use the ln-s command to create a software link under/usr/sbin/for convenient operation.
Let's look at the effect of a server. The code is as follows:
Server {
Listen 80;
Server_name www.geekso.com;
Index index.html index.htm index. php;
Root/Users/han/Documents/git/msg/web/public;
Location =/favicon. ico {
Log_not_found off;
Access_log off;
}
Location =/robots.txt {
Allow all;
Log_not_found off;
Access_log off;
}
Location /{
Try_files $ uri // index. php? $ Args;
}
Location ~ \. Php $ {
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Include fastcgi. conf;
}
Location ~ /(\. Svn | \. git | \. ht | \. DS ){
Deny all;
Internal;
}
Location ~ * \. (Js | css | png | jpg | jpeg | gif | ico) $ {
Expires max;
Log_not_found off;
}
}
Then run the sudo command to restart nginx, access www.111cn.net, and find that the php file can be accessed and executed. When accessing images, js, css..., 403 forbidden is reported?
403 does not have the permission. Well, with the permission 750, it should be able to solve the problem. In addition, the discovery is still 403. Is it possible that I have configured nginx incorrectly? I still can't find the problem after reading one line. I have been wondering why php files in the same directory can be accessed. If I access other files, I will report 403, various exclusion methods, and nginx, or not. In the end, google search really found the person who met me.
Solution: Use ls-l to view/Users/,/Users/xxx/,/Users/xxx/Documents/,/Users/xxx/Documents/git/permissions, make sure that the last x is included (the execution permission of other Users). If/Users/xxx/statements/lacks x, run chmod o + x/Users/xxx/Documents/to add the x permission.
In fact, permissions are also a problem after half a day.