Apache迁移到Nginx - connect()失败(111:连接被拒绝),同时连接到上游

时间:2014-12-08 11:13:34

标签: php apache codeigniter nginx

我最近将一个php(codeigniter)网站从apache迁移到了nginx,我的nginx服务器上已经运行了一个nodejs和html网站。

我在apache的错误日志中看到此错误

connect() failed (111: Connection refused) while connecting to upstream, client: X.X.X.X, server: contextsdk-api.semusi.com, request: "POST /v1/Data HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "sdk-api.XXX.com"

这是我的nginx配置

upstream api {
    server 127.0.0.1:9000;
}
server {
        listen   80;

        root /home/azureuser/contextsdkapi;
        server_name contextsdk-api.semusi.com;

        location / {
                try_files $uri $uri/ /index.php;
            }

        location ~ .php$ { ## Execute PHP scripts
            if (!-e $request_filename) { rewrite / /index.php last; }
            expires off; ## Do not cache dynamic content
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param MAGE_RUN_CODE default;
            fastcgi_param MAGE_RUN_TYPE store;
            include fastcgi_params;
        }

         location ~/\.ht {
        deny all;
    }

}

更新 -

我将我的nginx配置,位置部分更改为

 location ~ .php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
    }

现在我收到错误 -

connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream

0 个答案:

没有答案