0

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?

1 Answer 1

0

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

3
  • 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, 2014 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, 2014 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 127.0.0.1:1234 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, 2014 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .