SlideShare a Scribd company logo
1 of 2
Download to read offline
puf f ingde v.co m

http://puffingdev.co m/setup-apache-to -serve-multiple-sites-fro m-a-single-dedicated-server/

Setup apache to serve multiple sites from a single dedicated
server
— December 24, 2013

In this article we will teach the reader how to use a singe
dedicated server, to serve as many websites as you want,
f rom a single dedicated server.
I remember when I had all my client's websites setup on
dif f erent shared hosting accounts, f rom dif f erent providers
etc, its a real pain to maintain..
Serving several sites f rom a single Ubuntu server is done by
using "vhosts", these can be name-based so you can serve
both www.f irstwebsite.com and www.secondwebsite.com f rom
the same server, but they can also be IP-based.

Each vhost has a number of conf ig f iles, and a webroot where the actual f iles reside, by def ault Ubuntu will
only have the def ault vhost setup, wich has its webroot at /var/www
In this example we will create 2 new vhosts f or the 2 examples above, and then we will disable the def ault
webroot, so the f irst thing we will do is create 2 new f olders, wich will serve as the webroot f olders f or the
2 domains

1. sudo mkdir /var/www/first websit e.com
2. sudo mkdir /var/www/secondwebsit e.com

Now we will use the conf ig f ile f rom the def ault vhost, as a starting point to create our conf ig f iles f or our
2 new vhosts

1. sudo cp /et c/apache2/sit es-available/default /et c/apache2/sit es-available/first websit e.com
2. sudo cp /et c/apache2/sit es-available/default
/et c/apache2/sit es-available/secondwebsit e.com

Now we have to edit BOT H these new conf ig f iles, as shown below, insert the "ServerName", and change
the "DocumentRoot" and "Directory" to point to your new webroot f olders
1. <Virt ualHost *:80>
2. ServerAdmin webmast er@first websit e.com
3. ServerName first websit e.com
4. Document Root /var/www/first websit e.com
5. <Direct ory />
6.

Opt ions FollowSymLinks

7.

AllowOverride All

8. </Direct ory>
9. <Direct ory /var/www/first websit e.com/>
10.

Opt ions -Indexes FollowSymLinks Mult iViews

11.

AllowOverride All

12.

Order allow,deny

13.

allow from all

14. </Direct ory>
15. ErrorLog ${APACHE_LOG_DIR}/error.log
16. # Possible values include: debug, info, not ice, warn, error, crit ,
17. # alert , emerg.
18. LogLevel warn
19. Cust omLog ${APACHE_LOG_DIR}/access.log combined
20. </Virt ualHost >

Now that we have our conf ig f iles setup, and our webroot f olders setup, we are ready to enable our new
vhosts, and disable our def aut one, do this by using the f ollowing commands:

1. sudo a2ensit e first websit e.com
2. sudo a2ensit e secondwebsit e.com
3. sudo a2dissit e default

Just one more thing lef t, we have to reset our Apache server so that it will reload its conf ig f iles.

1. sudo service apache2 reload

T hats it, you have now successf ully setup you Ubuntu server to serve several sites f rom a single server.
However, if you are f ollowing this tutorial, and are having trouble, f eel f ree to drop a comment here
Copyright 2013 - Puf f ingDev.com. All Rights Reserved.

More Related Content

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

setup apache to serve multiple sites from a single dedicated server

  • 1. puf f ingde v.co m http://puffingdev.co m/setup-apache-to -serve-multiple-sites-fro m-a-single-dedicated-server/ Setup apache to serve multiple sites from a single dedicated server — December 24, 2013 In this article we will teach the reader how to use a singe dedicated server, to serve as many websites as you want, f rom a single dedicated server. I remember when I had all my client's websites setup on dif f erent shared hosting accounts, f rom dif f erent providers etc, its a real pain to maintain.. Serving several sites f rom a single Ubuntu server is done by using "vhosts", these can be name-based so you can serve both www.f irstwebsite.com and www.secondwebsite.com f rom the same server, but they can also be IP-based. Each vhost has a number of conf ig f iles, and a webroot where the actual f iles reside, by def ault Ubuntu will only have the def ault vhost setup, wich has its webroot at /var/www In this example we will create 2 new vhosts f or the 2 examples above, and then we will disable the def ault webroot, so the f irst thing we will do is create 2 new f olders, wich will serve as the webroot f olders f or the 2 domains 1. sudo mkdir /var/www/first websit e.com 2. sudo mkdir /var/www/secondwebsit e.com Now we will use the conf ig f ile f rom the def ault vhost, as a starting point to create our conf ig f iles f or our 2 new vhosts 1. sudo cp /et c/apache2/sit es-available/default /et c/apache2/sit es-available/first websit e.com 2. sudo cp /et c/apache2/sit es-available/default /et c/apache2/sit es-available/secondwebsit e.com Now we have to edit BOT H these new conf ig f iles, as shown below, insert the "ServerName", and change the "DocumentRoot" and "Directory" to point to your new webroot f olders
  • 2. 1. <Virt ualHost *:80> 2. ServerAdmin webmast er@first websit e.com 3. ServerName first websit e.com 4. Document Root /var/www/first websit e.com 5. <Direct ory /> 6. Opt ions FollowSymLinks 7. AllowOverride All 8. </Direct ory> 9. <Direct ory /var/www/first websit e.com/> 10. Opt ions -Indexes FollowSymLinks Mult iViews 11. AllowOverride All 12. Order allow,deny 13. allow from all 14. </Direct ory> 15. ErrorLog ${APACHE_LOG_DIR}/error.log 16. # Possible values include: debug, info, not ice, warn, error, crit , 17. # alert , emerg. 18. LogLevel warn 19. Cust omLog ${APACHE_LOG_DIR}/access.log combined 20. </Virt ualHost > Now that we have our conf ig f iles setup, and our webroot f olders setup, we are ready to enable our new vhosts, and disable our def aut one, do this by using the f ollowing commands: 1. sudo a2ensit e first websit e.com 2. sudo a2ensit e secondwebsit e.com 3. sudo a2dissit e default Just one more thing lef t, we have to reset our Apache server so that it will reload its conf ig f iles. 1. sudo service apache2 reload T hats it, you have now successf ully setup you Ubuntu server to serve several sites f rom a single server. However, if you are f ollowing this tutorial, and are having trouble, f eel f ree to drop a comment here Copyright 2013 - Puf f ingDev.com. All Rights Reserved.