I have configured aws instance from amazon ec2 linux image and configured nginx and php on server. Server serves html pages normally but don't serve php pages and also shows 503 Bad gateway error when open in browser.
Below is my nginx server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#include snippets/fastcgi-php.conf;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
}
I have also configured php-fpm. Below are the log extract from nginx error log.
2016/07/05 13:11:34 [error] 3969#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 45.117.48.117, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "52.66.51.131"
2016/07/05 13:11:35 [error] 3969#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 45.117.48.117, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "52.66.51.131"
2016/07/05 13:11:42 [error] 3969#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 45.117.48.117, server: _, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "52.66.51.131"
2016/07/05 13:12:18 [error] 3969#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 45.117.48.117, server: _, request: "GET /phpinfo.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "52.66.51.131"
I would highly appreciate any feedback on this. Also when i start php-fpm service it gives me below message
Starting php-fpm-5.6: [05-Jul-2016 13:15:20] WARNING: [pool www] ACL set, listen.owner = 'nginx' is ignored [05-Jul-2016 13:15:20] WARNING: [pool www] ACL set, listen.group = 'nginx' is ignored
[ OK ]
Thanks