В чем ошибка настройки Nginx на MacOS X?

Друзья, добрый день.

Помогите разобраться, я прям голову уже сломал. Настраиваю виртуальные хосты на макбуке, чтобы потестировать локально пару CMSок. Делаю по инструкции связку через Homebrew: nginx+php-fpm+mysql

Localhost работает нормально:
localhost:~ user$ curl -IL http://localhost:80
HTTP/1.1 200 OK
Server: nginx/1.8.0
Date: Sun, 24 May 2015 12:39:19 GMT
Content-Type: text/html
Content-Length: 853
Last-Modified: Sun, 24 May 2015 08:15:56 GMT
Connection: keep-alive
ETag: "556188bc-355"
Accept-Ranges: bytes


А вот настроенные по инструкции виртуальные хосты нет:
localhost:~ user$ curl -IL http://site.local:80
HTTP/1.1 403 Forbidden
Server: nginx/1.8.0
Date: Sun, 24 May 2015 12:43:52 GMT
Content-Type: text/html
Content-Length: 168
Connection: keep-alive


nginx.conf:
worker_processes  1;
 
error_log  /usr/local/etc/nginx/logs/error.log debug;
 
events {
    worker_connections  1024;
}
 
http {
    include             mime.types;
    default_type        application/octet-stream;
 
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
    access_log  /usr/local/etc/nginx/logs/access.log  main;
 
    sendfile            on;
 
    keepalive_timeout   65;
 
    index index.html index.php;
 
    include /usr/local/etc/nginx/sites-enabled/*;
}


Конфиг виртуального хоста:
server {
    listen       80;
    server_name  site.local www.site.local;
    root      /Users/user/Dropbox/Sites/site.local;
 
# Enable compression, this will help if you have for instance advagg module
        # by serving Gzip versions of the files.
        gzip_static on;

        # Block access to "hidden" files and directories whose names begin with a
        # period. This includes directories used by version control systems such
        # as Subversion or Git to store control files.
        location ~ (^|/)\. {
                return 403;
        }
 
        location / {
                # This is cool because no php is touched for static content
        include   /usr/local/etc/nginx/conf.d/php-fpm;
                try_files $uri @rewrite;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}


В hosts добавлен 127.0.0.1 site.local, симлинки прописаны, nginx перезагружался. Вообще не первый раз это делаю, но на маке впервые. MAMP и прочими пользоваться не хочу, ибо Апач не люблю, да и сервер потом на nginx будет, как бы хочется достоверности.

В общем все по инструкции. А не пашет. Где я лох? =(
  • Вопрос задан
  • 971 просмотр
Решения вопроса 1
@asd111
server {
    charset utf-8;
    client_max_body_size 128M;

    listen 80; ## listen for ipv4
    #listen [::]:80 default_server ipv6only=on; ## listen for ipv6

    server_name site.local www.site.local;
    root        /Users/user/Dropbox/Sites/site.local;;
    index       index.php;

    #Если нужно хранить логи nginx в папке проекта 
    #то создать указанные ниже файлы и раскомментировать 
    #access_log  /Users/user/Dropbox/Sites/site.local/log/access.log; 
    #error_log   /Users/user/Dropbox/Sites/site.local/error.log;

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php?$args;
    }

    # uncomment to avoid processing of calls to non-existing static files by
    #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    #    try_files $uri =404;
    #}
    #error_page 404 /404.html;

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
        #fastcgi_pass   127.0.0.1:9000;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        try_files $uri =404;
    }

    location ~ /\.(ht|svn|git) {
        deny all;
    }
}
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 2
BuriK666
@BuriK666 Куратор тега Nginx
Компьютерный псих
включайте error_log и смотрите почему 403.
Ответ написан
Комментировать
evnuh
@evnuh
Поиск Гугл помог мне, впусти и ты его в свой дом
нет location @rewrite, либо он в conf.d/php-fpm, покажите его
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы