0% found this document useful (0 votes)
5 views3 pages

AWS Ec2 Virtual Hosting

The document outlines the prerequisites and steps to set up virtual hosts on an AWS EC2 instance running Ubuntu with Apache and MySQL. It details how to configure Apache's 000-default.conf file for multiple domains and subdomains, including setting the ServerName, DocumentRoot, and logging options. Additionally, it provides examples of virtual host configurations for different applications and environments.

Uploaded by

dipesh.thali03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

AWS Ec2 Virtual Hosting

The document outlines the prerequisites and steps to set up virtual hosts on an AWS EC2 instance running Ubuntu with Apache and MySQL. It details how to configure Apache's 000-default.conf file for multiple domains and subdomains, including setting the ServerName, DocumentRoot, and logging options. Additionally, it provides examples of virtual host configurations for different applications and environments.

Uploaded by

dipesh.thali03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

->> Prerequisites: 1) AWS Account, 2)eC2 instance => Ubuntu,Apache,MySql, 3) Domain name

and some SubDomains => www.example.com, app.example.com, www.anotherDomain.com.

->> 1) get your instance running and setup everything from the AWS docs.
2) point all the domains to your instance's public IP.
3) now ssh into your instance and goto etc/apache2/sites-available/000-default.conf
4) open the file in a text editor and set it up like below:
{{{{{{{{{{{{{-------------------------------------------------------}}}}}}}}}}}}}

NameVirtualHost *:80
#make a virtual host for every domain and subDomain
<VirtualHost *:80>
​ ​ #Required-> Name of the Domain
​ ​ ​ ServerName example.com

​ ​ ​ #Email for the Server Admin


​ ​ ​ ServerAdmin [email protected]

​ ​ ​ #Directory to goto when that Domain is called


​ ​ ​ DocumentRoot /var/www/app1/public

​ ​ ​ #this is required to give all views properly for that laravel app
​ ​ ​ <Directory /var/www/app1/public>
​ ​ AllowOverride All
​ ​ ​ </Directory>

​ ​ ​ ErrorLog ${APACHE_LOG_DIR}/error.log
​ ​ ​ CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
​ ​ ​ ServerName app.example.com

​ ​ ​ ServerAdmin [email protected]

​ ​ ​ DocumentRoot /var/www/app2/public

​ ​ ​ <Directory /var/www/app2/public>
​ ​ AllowOverride All
​ ​ ​ </Directory>

​ ​ ​ ErrorLog ${APACHE_LOG_DIR}/error.log
​ ​ ​ CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:80>
​ ​ ​ ServerName anotherDomain.com

​ ​ ​ ServerAdmin [email protected]

​ ​ ​ DocumentRoot /var/www/app3/public

​ ​ ​ <Directory /var/www/app3/public>
​ ​ AllowOverride All
​ ​ ​ </Directory>

​ ​ ​ ErrorLog ${APACHE_LOG_DIR}/error.log
​ ​ ​ CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

{{{{{{{{{{{{{---------------------Done---------------------}}}}}}}}}}}}}

====================for domains===============================
<VirtualHost *:80>
DocumentRoot "/xampp/htdocs/zf2/ZendSkeletonApplication/public"
ServerName new
ServerAlias www.ZendSkeletonApplication.dev
SetEnv APPLICATION_ENV "development"
<Directory "/xampp/htdocs/zf2/ZendSkeletonApplication/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/xampp/htdocs/zf2/ZendSkeletonApplication/public"
ServerName Localhost
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

You might also like