I want to host my php website on AWS EC2 Windows Server 2016. I have party success on the process as i can use the ip or hostname to access the HTML web page but when i try to create a test.php and view it in my PC and got an error said 404 files not found. However i can view test.php in the Server side PC by remote.
I am not sure is that any config or setting missing there, i try to mark all my steps below and see if any mistakes:
Those are my steps for the setup. Does any one have some ideas on it?? Thanks.
As RiggsFolly suggests you need pick between IIS or Apache (the 'A' in WAMP). If you have 2 services like IIS and Apache competing for port 80 one will fail to start properly and not necessarily the same one each time.
If both services are running i suspect one will be listening on the public IP of the machine, and the other listening to the loopback address (local only).
WAMP
If you want to stick with WAMP, will you need to either uninstall or stop and disable the IIS service, then restart WAMP to ensure its Apache receiving the requests.
IIS (WIMP?)
If you want to use IIS to host a Php application its a bit more complicated and you will probably need to uninstall WAMP, then manually install and configure Php and MySQL.
Installing Php into IIS is pretty strait forward: https://learn.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php
Broadly speaking the steps are:
For your database, you can install MySQL Server onto your ec2-instance (latest download and instructions - https://dev.mysql.com/downloads/mysql/). If your running MySQL on the instance do not open port 3306 (mysql) to the world - it should only be accessible to IP's where you administer the database.
Personally i would recommend hosting the database in RDS or Aurora and let AWS take care of the database server details. When setting up the security group for the database, ensure you only allow your server access and any administrative IP addresses you own.