[AWS] How to develop Temporary Web System ~Part5: Install PHP~

First of all

In my last article, I’ve introduced how to install nginx to EC2 instance. In this article, let’s install PHP.

System Requirement
  • Web site can be accessed on the Internet with FQDN
  • Basic LAMP environment (Linux, Nginx, PHP, MySQL)
  • No redundant configuration and backup
System Configuration

System Configuration diagram is as below. Public Users access Web site through Route53 with FQDN. On the other hand, Administrator access to Web site via Internet Gateway.

Install PHP

Firstly, access to EC2 instance and becomes root user.
And, install php and php-fpm packages as below.


After installing the php and php-fpm packages, check if the php has been installed successfully.

FPM is abbreviation of FastCGI Processing Manager. It needs to be installed by using PHP associated with nginx. CGI means Common Gateway Interface and has function to operate user’s program on the web server.

Next, change the setting of php-fmd setting, www.conf. Apache user is designated to www.conf by default, you need to change it to nginx user.

Next, change the setting of nginx, default.conf and enable PHP setting.

I’ve set document root to /usr/share/nginx/html.
Under this document root, create index.php file for your access test.

Next, restart nginx and php-fpm process as below.

Finally, access EC2 instance with public DNS.
You can see the page that you created !!

This is the end of part5, PHP installation. I hope you could associate PHP and Nginx successfully. In my next article, let’s install MySQL.