How to install Nginx on Mac OS X

Source: Internet
Author: User
Tags php file

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.