How to consistently setup PHP-FPM 5.6 with nginx on Amazon EC2 AMI instance -


i cannot find way setup php-fpm on nginx on amazon ami ec2 instance scratch. know should not difficult, finding different answers based on *nix versions confusing.

here condensed steps i've taken thought work, don't. have set of steps reliably setup php-fpm nginx in amazon ami ec2 instance?

i've intentionally left out nginx.conf, etc post since "stock" installations default yum repositories.

nginx version: 1.6.2

does have reliable steps setup php-fpm in nginx amazon ami ec2 instances? prefer setup myself instead of using ami in amazon marketplace charges setup.

thanks

# install packages yum install -y nginx yum install -y php56-fpm.x86_64  # enable php in nginx.conf vi /etc/nginx/nginx.conf # add index.php @ beginning of index   index   index.php index.html index.htm;  # uncomment php block in nginx.conf     location ~ \.php$ {         root           html;         fastcgi_pass   127.0.0.1:9000;         fastcgi_index  index.php;         fastcgi_param  script_filename  /scripts$fastcgi_script_name;         include        fastcgi_params;     }  # tell php-fpm run same account nginx vi /etc/php-fpm-5.6.d/www.conf - change user , group apache nginx  # allow nginx user read website files since typically owned root cd /usr/share/nginx chown -r nginx:nginx html  # check see if php works - doesn't these steps echo "<?php phpinfo(); ?>" > /usr/share/nginx/info.php  # restart services since changed things service nginx restart service php-fpm-5.6 restart  # verify root path exists , owned nginx said above # ls -l /usr/share/nginx/html -rw-r--r-- 1 nginx nginx 3696 mar  6 03:53 404.html -rw-r--r-- 1 nginx nginx 3738 mar  6 03:53 50x.html -rw-r--r-- 1 nginx nginx 3770 mar  6 03:53 index.html -rw-r--r-- 1 nginx nginx   20 apr 14 14:01 index.php  # verified php-fpm listening on port 9000 , nginx setup way in nginx.conf # port 9000 usage default , left as-is question, prefer use sock once working. 

edit

this see in nginx error log

2015/04/14 17:08:25 [error] 916#0: *9 fastcgi sent in stderr: "primary script unknown" while reading response header upstream,  client: 12.34.56.78, server: localhost, request: "get /index.php http/1.1",  upstream: "fastcgi://127.0.0.1:9000", host: "12.34.56.90"  

what see in nginx error log (/var/log/nginx/errors.log)?

added after additional info (logs) provided:

to me looks root should server section not location.

server {  ...     root   /usr/share/nginx/html;     ...     location ~ \.php$ {         fastcgi_pass   127.0.0.1:9000;         fastcgi_index  index.php;         fastcgi_param  script_filename  /scripts$fastcgi_script_name;         include        fastcgi_params;     } } 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -