LEMP is a complete package to run any web application on a server. LEMP signifies the Linux, Nginx, MySQL and Php. Nginx is used as the web-server for hosting of an application where as MySQL is used as systematic data storage of application & Php is popular server side scripting language which is used for web development as well bridging the gap between application and the database.
Step 1. Open your EC2 Terminal and update your Packages.
Step 2. Install Nginx Webserver.
Step 3. Every virtual host needs its own configuration file in the /etc/nginx/sites-available/ directory. Create the file for example.com, called /etc/nginx/sites-available/example.com, with the following content. Make sure to replace example.com with your own domain name.
Step 4. Restart Nginx.
Step 5. Now direct your browser to http://ip or www.example.com and you should see the Nginx page like this.
Step 6. Install Php-fpm for nginx.
Step 7. Configure php for Nginx.
Step 8. The document root of the Nginx webserver is /usr/share/nginx/www. Now We will now create PHP file (index.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.
Step 9. Use following commands to enable the site.
Step 10. Restart Nginx.
Step 11. Finish up by visiting your php info page.The page should look like this.
Step 12. Install mysql-server in your Machine by running bellow command from your terminal.
Step 13. Specify New password for Mysql root user.
Note: Confirm Password for Mysql root user.