Menu
Amazon Elastic Compute Cloud
User Guide for Windows Instances

Tutorial: Installing a WAMP Server on an Amazon EC2 Instance Running Windows Server

This tutorial shows you how to install an Apache web server with PHP and MySQL on an EC2 instance running Windows Server. This software configuration is sometimes called a WAMP server or WAMP stack (Windows, Apache, MySQL, PHP). For information about how to create a similar server on Linux, see Tutorial: Installing a LAMP Web Server in the Amazon EC2 User Guide for Linux Instances.

A WAMP stack is designed for easy installation to help developers get up and running quickly. It is not designed for production environments for the following reasons:

  • The default configurations do not meet security requirements for most production environments.

  • Upgrading and patching the different software components on a single production server would affect server availability.

  • The WAMP one-click installers do not place files in standard locations, which can make it difficult to locate important configuration files.

You can, however, create a WAMP stack on an EC2 instance to prototype a web project in a controlled test environment. For example, you can host a static website or deploy a dynamic PHP application that reads and writes information to a database.

There are many third-party solutions that you can use to install a WAMP stack; this tutorial uses the Bitnami WAMP stack. For more information, see Review: WAMP stacks for Web developers.

Prerequisites

Before you begin:

  • Provision a Windows Server 2008 R2 or 2012 R2 base instance. You must configure the base instance with a public domain name system (DNS) name that is reachable from the Internet. For more information, see Getting Started with Amazon EC2 Windows Instances. Optionally, you might be eligible to configure the base instance on the AWS free tier. The free tier is designed for users with new AWS accounts who want to gain experience with AWS. For more information about the free tier and eligibility requirements, see AWS Free Tier.

    Important

    If you launch a non-free tier instance and use it to deploy your stack, you will incur the standard Amazon EC2 usage fees for the instance until you terminate it. For more information, see Amazon EC2 Pricing.

  • Verify that the security group for your instance has the following ports open:

    • 80 (HTTP inbound and outbound) - Port 80 allows computers outside of the instance to connect by using HTTP.

    • 443 (HTTPS inbound and outbound) - Port 443 allows computers outside of the instance to connect by using HTTPS.

    • 3389 (RDP inbound only) - Port 3389 allows you to connect to the instance with Remote Desktop Protocol (RDP). As a security best practice, restrict RDP access to a range of IP addresses in your organization.

    For more information about these prerequisites, see Setting Up with Amazon EC2.

To install a WAMP server

  1. Connect to your instance using Microsoft Remote Desktop. For more information, see Connecting to Your Windows Instance.

  2. Disable Internet Explorer Enhanced Security Configuration so that you can download and install required software from the web.

    1. In your Windows Server 2008 or 2012 instance, open Server Manager.

      • On Windows Server 2008 R2, under Server Summary, in the Security Information section, click Configure IE ESC.

      • On Windows Server 2012 R2, click Local Server in the left pane. In the Properties pane, locate IE Enhanced Security Configuration. Click On.

    2. Under Administrators, click Off, and then click OK.

    3. Close Server Manager.

    Note

    Make a note to re-enable Internet Explorer Enhanced Security Configuration when you have finished installing software from the web.

  3. Install software updates to ensure that the instance has the latest security updates and bug fixes.

    1. EC2Config - Download and install the latest version of the EC2Config service. For more information about how to install this service, see Installing the Latest Version of EC2Config.

    2. Windows Update - Run Windows Update to ensure that the latest security and software updates are installed on the instance. In Control Panel, click System and Security. In the Windows Update section, click Check for updates.

  4. Download and install the WAMP stack. For the purposes of this tutorial, we suggest that you download and install this WAMP stack. You can, however, download and install other Bitnami WAMP stacks. Regardless of which stack you install, the Bitnami site prompts you to either create a free Bitnami account or log in by using a social media account. After you log in, run the Bitnami setup wizard.

  5. After setup completes, verify that the Apache web server is configured properly and running by browsing to a test page. Open a web browser on a different computer and enter either the public DNS address of the WAMP server or the public IP address. The public DNS address for your instance is listed on the Amazon EC2 console in the Public DNS column. If this column is hidden, click the Show/Hide icon and select Public DNS.

    Important

    If you do not see the Bitnami test page, use Windows Firewall with Advanced Security to create a custom rule that allows the HTTP protocol through port 80 and the HTTPS protocol through port 443. For more information, see Windows Firewall with Advanced Security Overview on Microsoft TechNet. Also verify that the security group you are using contains a rule to allow HTTP (port 80) connections. For information about adding an HTTP rule to your security group, see Adding Rules to a Security Group.

  6. Test your WAMP server by viewing a PHP file from the web. You must be logged onto the instance as an administrator to perform the following steps.

    1. Create a file called phpinfo.php containing the code below and place this file in the Apache root directory. By default, the path is: C:\Bitnami\wampstack-version_number\apache2\htdocs.

      Copy
      <?php phpinfo(); ?>
    2. In a web browser, enter the URL of the file you just created. This URL is the public DNS address of your instance followed by a forward slash and the file name. For example:

      http://my.public.dns.amazonaws.com/phpinfo.php

    3. Verify that the PHP information page is displayed. If the page does not display, verify that you entered the correct public DNS address. Also verify that Windows folder options are configured to show known file extensions. By default, folder options hide known file extensions. If you created the file in Notepad and saved it in the root directory your phpinfo.php file might incorrectly be saved as phpinfo.php.txt.

    4. As a security best practice, delete the phpinfo.php file when you finish testing the WAMP server.

  7. Enhance MySQL security by disabling default features and by setting a root password. The mysql_secure_installation Perl script can perform these tasks for you. To run the script, you must install Perl.

    1. Download and install Perl from the Perl Programming Language website.

    2. In the C:\Bitnami\wampstack-version_number\mysql\bin directory, double-click mysql_secure_installation.

    3. When prompted, enter the MySQL root account password that you entered when you ran the Bitnami WAMP stack installer, and then press Enter.

    4. Type n to skip changing the password.

    5. Type Y to remove the anonymous user accounts.

    6. Type Y to disable remote root login.

    7. Type Y to remove the test database.

    8. Type Y to reload the privilege tables and save your changes.

    If you successfully completed the steps in this tutorial, then your WAMP server is functioning properly. To continue testing, you can add more content to the C:\Bitnami\wampstack-version_number\apache2\htdocs folder and view the content by using the public DNS address for your instance.

Important

As a best practice, stop the MySQL server if you do not plan to use it right away. You can restart the server when you need it again.