I have read many articles and also topics in SF, but could not find out any clue to my case.

I have on instance of AWS-EC2, and want to hold several public sites within it.

I have already get my first public site to run like below:

What I have done is just added a file which named manmu under

<VirtualHost *:80>
    ServerName ec2-50-xxx-214-xxx.us-west-2.compute.amazonaws.com
    DocumentRoot /home/ubuntu/manmu/YYYYY/web
    DirectoryIndex index.php

and then
ubuntu@ip-10-245-38-136:/etc/apache2/sites-enabled$ ln -s ../sites-available/manmu

But how could I get my other sites to run?
For example, I may want some subdomains such as:
and so on.

Thank you. Best regards, tech_me

  • you'll have your own domain for that and specify each domain name as apache virtual hosts. – Andrei Mikhaltsov Jun 10 '13 at 13:14
  • 2
    Take EC2 out of the picture. Virtual hosting is exactly the same there as it is on any other linux server. – EEAA Jun 10 '13 at 13:26
  • @EEAA Thank you. Yes, I am very not familiar with Linux but I still try to configure apache. I could have my local machine to run multiple sites(I mean url) such as: http://abc.manmu.localhost, http://def.manmu.localhost, which I am using /etc/hosts and /etc/apache2/site-availables(and ../site-enabled). But I do really not know how to configure AWS for public access of multiple urls. – tech_me Jun 11 '13 at 11:57
  • @AndreiMikhaltsov Thank you. But I just want to try AWS not to buy any domain now. – tech_me Jun 11 '13 at 11:59
  • @tech_me - if you want to use name-based virtual hosting, you have two choices. 1) buy a domain or 2) use your hosts file to map names to your server's IP address. With option 2, those names will only be available to your specific workstation, so obviously you'll need to use option 1 if others need access to these sites. – EEAA Jun 11 '13 at 12:02

You can't create subdomains of the EC2-provided hostname. You must use name-based virtual hosting with your own domain name.

  • Thank you @MichaelHampton. I just heard something like Elastic IP, does this any help which instead of a real domain. – tech_me Jun 11 '13 at 12:25

You can do Name Based Virtual hosting in Apache and can configure multiple websites on single server.

  <VirtualHost *:80>
  # This first-listed virtual host is also the default for *:80
  ServerName www.example.com
  ServerAlias example.com 
  DocumentRoot /www/domain

  <VirtualHost *:80>
  ServerName other.example.com
  DocumentRoot /www/otherdomain

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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