Skip to content

Instantly share code, notes, and snippets.

@basitiyidir
Last active April 1, 2016 05:43
Show Gist options
  • Save basitiyidir/16066a8772e18aa203ccf3b111cf0c39 to your computer and use it in GitHub Desktop.
Save basitiyidir/16066a8772e18aa203ccf3b111cf0c39 to your computer and use it in GitHub Desktop.
Amazon EC2 Nginx, PHP7

Amazon EC2 Nginx, PHP7

Install

$ sudo rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
$ sudo yum install --enablerepo=webtatic-testing php70w php70w-devel php70w-fpm php70w-mysql php70w-mbstring php70w-pdo
$ sudo yum install nginx

Nginx conf

/etc/nginx/nginx.conf

   root /var/www/html;

   location ~ .php$ 
   { 
      fastcgi_pass 127.0.0.1:9000; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name; 
      include fastcgi_params; 
   }

php-fpm conf

/etc/php-fpm.d/www.conf

... 
... 
user = nginx 
group = nginx 
... 
... 
$ sudo service php-fpm start $ sudo service nginx start
$sudo cd /var/lib/php/session
$sudo chown 777 session/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment