Iis – Running Apache and IIS on Amazon EC2 on a single windows instance

amazon ec2apache-2.2apache-2.4iiswindows-server-2008

My question is about running Apache and IIS on a single Amazon EC2 windows instance.
I did a lot of search but until now it is not clear for me how to do it.

I have multiple websites and web applications. Some of them written in php (wordpress, etc) some of them is ASP.NET C#. I want to collect all of websites on a single amazon ec2 windows instance. For this I have to install apache and iis together. But how can I achieve to run both of them on same server. Via Elastic IP?

By the way I thought running php sites on IIS can be difficult due to plugins, extensions etc. Also performance issues is another problem.

Can anyone provide step by step guide for this?

Best Answer

This is not a step by step guide, but should start giving you an overall idea of what's involved.

You can have both Apache and IIS running on the same machine (regardless whether it's an EC2 or some other sort of server), and if you don't mind having them running on different ports then it should be fairly easy.

  • Bind IIS to port 80 (for example)
  • Bind Apache to port 8088

Make sure you configure the security group into which the EC2 is located to allow inbound traffic to port 80 and 8088.

Assign an elastic IP to your EC2.

At that point the Apache hosted websites are going to be reachable through:

http://my.elasticip.address:8088/...

and the IIS ones through:

http://my.elasticip.address/...

Alternatively you could assign multiple internal IPS to the EC2 and bind IIS and Apache to one specific ip (that way both web servers could listen on the default HTTP port).

http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/ApiReference-cmd-AssignPrivateIpAddresses.html

This part would require more research / tests, since I don't think you can assign an elastic ip to a specific internal EC2 ip address, unless your EC2 is inside a VPC (http://aws.amazon.com/vpc/).