Nginx problems in Mac OS X installation

Source: Internet
Author: User

Install Nginx under Mac OS X there are not many friends, because in the MAC system installation Nginx environment is not practical, but someone touched us together to see, maybe it will help you.

I was nginx through the brew install, and the front was smooth,

Nginx Common commands:

Nginx-s Stop/quit/reopen/reload

Use the Ln-s command to create a software link under/usr/sbin/for easy operation.

directly to a server to see the effect, 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 $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 sudo command restart Nginx, access to www.3lian.net found PHP files can access the execution, access to pictures, JS, css ... Just report 403 Forbidden?

403 is not without permission, OK, plus permission 750 should be able to resolve, plus to find or 403, this does not understand. Will I nginx configuration wrong, a line to see, or did not find the problem, has been thinking why the same directory of PHP files can be accessed, access to other documents on the report 403, all kinds of exclusion, engage in nginx, or not. Finally by Google search and really found the same people as I met.

Solution: Use Ls-l to view/users/,/users/xxx/,/users/xxx/documents/,/users/xxx/documents/git/permissions to ensure that the last X (other user's execution rights) is included, if/ users/xxx/documents/missing X, execute chmod o+x/users/xxx/documents/add x permissions.

Actually engaged in a half-day is also a question of authority.

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.