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?


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:


and the IIS ones through:


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).


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/).

  • First option seems easy but I wonder about this: Let say I have a website abc.com when I change dns setting to point my.elasticip.address:8088 user will be redirected to abc.com:8080 ? – gandil Feb 17 '14 at 2:35
  • No, unless you'll write specific code in your website's logic to handle the redirection. Or you could do it through an .htaccess directive. – adriano72 Feb 17 '14 at 16:13
  • I set up an environment. IIS mapped to 80, and apache mapped to 1234. I assign an elactic ip and change my domain DNS to point elastic IP. When I browse my domain abc.com IIS 8 default page is browsed. That is ok. But I want to point my abc.com to apahce (port 1234) for this purpose I edit hosts file under system32 and abc.com. But when I browse abc.com IIS page comes again. How can I do this. My need is very obvious. I want to use some php site under apache some .net site under iis. But user should not see port number. – gandil Feb 24 '14 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.