CodeIgniter + Nginx + PHP-FPM в Mac OS X Lion - PullRequest
1 голос
/ 14 февраля 2012

Итак, я установил Nginx и PHP-FPM через Homebrew, но безрезультатно смог установить и запустить мою локальную систему.

Я продолжаю получать сообщение об ошибке Nginx 502. Bad Gateway.

Вот мой Nginx.conf

user  nobody;
worker_processes  1;

error_log  /var/log/nginx/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        /var/run/nginx.pid;


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  /var/log/nginx/access.log main;

    sendfile        on;
    #tcp_nopush     on;
    charset                   utf-8;
    source_charset            utf-8;
    ignore_invalid_headers    on;
    server_name_in_redirect   off;

#    keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay off;
    tcp_nopush  on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    index index.html index.php;

    include /usr/local/etc/nginx/sites-enabled/*;
}

Vhost File:

server {
    index index.htm index.php index.html
    listen   80;
    server_name  site.local;

    access_log  /var/log/nginx/site.local_access.log;
    error_log /var/log/nginx/site.local_error.log;

    root   /Users/dennismonsewicz/Sites/site;

    location ~* ^.+\.(jpg|jpeg|gif|png|css|zip|pdf|txt|js|flv|swf|html|htm)$
        {
                expires max;
                log_not_found off;
        }

        # Serve the directoy/file if it exists, else pass to CodeIgniter front controller
        location / {
            try_files $uri $uri/ /index.php;
        }

        location ~ \.php$ {
                fastcgi_pass    127.0.0.1:9000;
                fastcgi_index   index.php;
                fastcgi_split_path_info ^(.+\.php)(.*)$;
                include fastcgi_params;
                fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

}

Файл PHP-FPM.conf

[global]
pid = /usr/local/Cellar/php/5.3.10/var/run/php-fpm.pid
daemonize = yes

[www]
listen = 127.0.0.1:9000
user = dennismonsewicz
group = staff
pm = dynamic
pm.max_children = 10
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 500
...