For the past few weekends, I’ve been busy migrating my website and WordPress blog from my previous hosting provider to the newly launched AWS Malaysia Region. Initially, my plan was to set everything up using the classic Linux/Apache stack, but after evaluating my project requirements (And my expertise in IIS 😅), I decided to go with Windows/IIS instead. This decision was largely based on familiarity, support, and ease of use for what I had in mind.
After a few challenges, I was able to complete the migration seamlessly, and to top it off, I secured everything using the AWS Certificate Manager (ACM) which provided me with a free SSL certificate! In this post, I’ll walk you through some of the steps I took to make this migration successful, and provide some extra instructions for those of you planning to run PHP and Laravel on IIS. Let’s dive in!
Migrating to AWS Malaysia Region
AWS recently launched its Infrastructure Region in Malaysia, offering improved latency and performance for those of us working out of Southeast Asia. The timing couldn’t have been better for my migration.
Here’s a quick rundown of the migration process:
- Setting up an EC2 Instance: I spun up a Windows Server EC2 instance using AWS Elastic Compute Cloud (EC2). AWS made it easy to select the region closest to me—AWS Malaysia Region—and launch a server instance that met my performance needs.
- Installing IIS: Once my Windows Server instance was up and running, I installed IIS (Internet Information Services) using the Server Manager.
- Migrating WordPress: I moved my WordPress site from my old host to AWS manually by copy the directory and export the SQL.
- Setting Up SSL with ACM: Security is always a top priority, and I took advantage of AWS Certificate Manager (ACM) to get a free SSL certificate for my domain. ACM automates the provisioning and renewal of SSL/TLS certificates, ensuring my website is secure without the need for manual intervention.
Everything was running perfectly—until I realized I also needed to host a Laravel application on this server.
Enabling PHP in IIS for Laravel
If you’re planning to run PHP-based applications like Laravel on IIS, there are some additional steps you’ll need to follow. Here’s a step-by-step guide to get PHP up and running on IIS, and ensure that Laravel works without issues:
1. Install PHP on Windows/IIS
First, you’ll need to install PHP on your IIS server.
- Download the PHP Windows Installer and choose the latest non-thread-safe version for your system.
- Extract the files to a directory, e.g., C:\php.
- Open IIS Manager, navigate to your server node, and click on Handler Mappings.
- Add a new Module Mapping with the following details:
- Once done, restart IIS.
2. Install FastCGI
To enable IIS to process PHP files, you’ll need to install FastCGI support.
- In Server Manager, click on Add Roles and Features.
- Navigate to Web Server (IIS) > Web Server > Application Development, and select CGI.
- Install FastCGI.
3. Configure PHP with IIS
You need to tell IIS where to find the PHP installation. Here’s how:
- Open your php.ini file (located in your PHP installation directory) and modify the following settings for Laravel:
- Enable required extensions for Laravel:
4. Install Composer
Now that PHP is up and running on IIS, the next step is to install Composer and Laravel.
- Download and install .
- Next, configure IIS to serve Laravel application.
5. URL Rewrite Module for IIS
Laravel requires the URL Rewrite Module to work correctly with IIS.
- Download and install the .
- Add the following rewrite rules to your site’s web.config file located in the Laravel root directory:
6. Database Setup
- Install MySQL and set up your database.
- Update the .env file in your Laravel app with the correct database credentials:
After following these steps, Laravel app should be fully functional on IIS!
Wrapping Up
Migrating my website, WordPress blog, and Laravel app to AWS Malaysia Region using Windows/IIS turned out to be a rewarding experience. By enabling PHP and configuring the necessary components, I’ve ensured my applications run smoothly and securely in the cloud. Thanks to AWS’s robust infrastructure and ACM’s free SSL certificates, I’m confident my setup will handle future growth and challenges with ease.
If you’re planning to do the same or have any questions, feel free to reach out. I’m more than happy to help!
Key AWS Services Used:
- EC2 for hosting the Windows/IIS server.
- ACM (AWS Certificate Manager) for free SSL certificates.
Exploring AWS free tier and expanding my tech knowledge has been a blast, and I highly recommend it to anyone looking to dive into cloud computing. It’s empowering to manage your own cloud infrastructure, and AWS offers great flexibility, whether you’re using Linux or Windows!