The following procedures help you install an Apache web server with PHP and MySQL support on your Amazon Linux instance (sometimes called a LAMP web server or LAMP stack). You can use this server to host a static website or deploy a dynamic PHP application that reads and writes information to a database. Show
If you are trying to set up a LAMP web server on a different distribution, such as Ubuntu or Red Hat Enterprise Linux, this tutorial will not work. For Amazon Linux 2, see Tutorial: Install a LAMP web server on Amazon Linux 2. For Ubuntu, see the following Ubuntu community documentation: ApacheMySQLPHP . For other distributions, see their specific documentation. Option: Complete this tutorial using automation To complete this tutorial using AWS Systems Manager Automation instead of the following tasks, run the AWSDocs-InstallALAMPServer-AL Automation document. Tasks
Step 1: Prepare the LAMP serverPrerequisites This tutorial assumes that you have already launched a new instance using the Amazon Linux AMI, with a public DNS name that is reachable from the internet. For more information, see Step 1: Launch an instance. You must also have configured your security group to allow SSH (port 22), HTTP (port 80), and HTTPS (port 443) connections. For more information about these prerequisites, see Authorize inbound traffic for your Linux instances. To install and start the LAMP web server with the Amazon Linux AMI
Apache httpd serves files that are kept in a directory called the Apache document root. The Amazon Linux Apache document root is
To allow the To set file permissions
Now, (Optional) Secure your web server A web server running the HTTP protocol provides no transport security for the data that it sends or receives. When you connect to an HTTP server using a web browser, the URLs that you visit, the content of webpages that you receive, and the contents (including passwords) of any HTML forms that you submit are all visible to eavesdroppers anywhere along the network pathway. The best practice for securing your web server is to install support for HTTPS (HTTP Secure), which protects your data with SSL/TLS encryption. For information about enabling HTTPS on your server, see Tutorial: Configure SSL/TLS with the Amazon Linux AMI. Step 2: Test your Lamp serverIf your server is installed and running, and your file permissions are set correctly, your To test your LAMP web server
Step 3: Secure the database serverThe default installation of the MySQL server has several features that are great for testing and development, but they should be disabled or removed for production servers. The mysql_secure_installation command walks you through the process of setting a root password and removing the insecure features from your installation. Even if you are not planning on using the MySQL server, we recommend performing this procedure. To secure the database server
You should now have a fully functional LAMP web server. If you add content to the Apache document root at Step 4: (Optional) Install phpMyAdminTo install phpMyAdmin phpMyAdmin is a web-based database management tool that you can use to view and edit the MySQL databases on your EC2 instance. Follow the steps below to install and configure phpMyAdmin on your Amazon Linux instance. We do not recommend using phpMyAdmin to access a LAMP server unless you have enabled SSL/TLS in Apache; otherwise, your database administrator password and other data are transmitted insecurely across the internet. For security recommendations from the developers, see Securing your phpMyAdmin installation. The Amazon Linux package management system does not currently support the automatic installation of phpMyAdmin in a PHP 7 environment. This tutorial describes how to install phpMyAdmin manually.
TroubleshootThis section offers suggestions for resolving common problems you may encounter while setting up a new LAMP server. I can't connect to my server using a web browser.Perform the following checks to see if your Apache web server is running and accessible.
The application software I want to run on my server is incompatible with the installed PHP version or other softwareThis tutorial recommends installing the most up-to-date versions of Apache HTTP Server, PHP, and MySQL. Before installing an additional LAMP application, check its requirements to confirm that it is compatible with your installed environment. If the latest version of PHP is not supported, it is possible (and entirely safe) to downgrade to an earlier supported configuration. You can also install more than one version of PHP in parallel, which solves certain compatibility problems with a minimum of effort. For information about configuring a preference among multiple installed PHP versions, see Amazon Linux AMI 2016.09 Release Notes. How to downgrade The well-tested previous version of this tutorial called for the following core LAMP packages:
If you have already installed the latest packages as recommended at the start of this tutorial, you must first uninstall these packages and other dependencies as follows:
Next, install the replacement environment:
If you decide later to upgrade to the recommended environment, you must first remove the customized packages and dependencies:
Now you can install the latest packages, as described earlier. Related topicsFor more information about transferring files to your instance or installing a WordPress blog on your web server, see the following documentation:
For more information about the commands and software used in this tutorial, see the following webpages:
For more information about registering a domain name for your web server, or transferring an existing domain name to this host, see Creating and Migrating Domains and Subdomains to Amazon Route 53 in the Amazon Route 53 Developer Guide. What tool command can be used to read and write data to ports over a network?The Netcat ( nc ) command is a command-line utility for reading and writing data between two computer networks. The communication happens using either TCP or UDP.
What type of testing procedure involves the testers analyzing the company security policy and procedures and reporting any vulnerabilities to management?Penetration testing is the exploitation of vulnerabilities present in an organization's network. It helps determine which vulnerabilities are exploitable and the degree of information exposure or network control that the organization could expect an attacker to achieve after successfully exploiting vulnerability.
What is the HTTP method that retrieves data by URL?The GET method requests data from a server using URL parameters. It is by far the most commonly used HTTP method on the web.
Which of the following is a text file generated by a Web server and stored on a users browser?A "cookie" is a small text file containing information, generated by a web site's server and placed on a user's-visitor's personal computer or smart device.
|