In my last article, I’ve introduced how to install nginx to EC2 instance. In this article, let’s install PHP.
- Web site can be accessed on the Internet with FQDN
- Basic LAMP environment (Linux, Nginx, PHP, MySQL)
- No redundant configuration and backup
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.
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.
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 !!