I recently migrated a php (codeigniter) site from apache to nginx, there is a nodejs and html site already running on my nginx server.
I am seeing this error in error log of 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"
Here is my nginx configuration
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;
}
}
Update -
I changed my nginx configuration, location section to
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;
}
Now i am getting the error as -
connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream