create multiple domains and subdomains with apache2

Posted on 2011-10-31
Medium Priority
Last Modified: 2012-05-12

I'm wondering how I can create multiple domains and subdomains. I'm using Spry. They have a DomainControl Panel but doesn't seem to really work. I read that I need to create a config file in etc/apache2/sites-available and then symlink it to /etc/apache2/sites-enabled.

1) Do I create a config file for each domain and sub-domain? What do I call the config file?
2) How do I symlink the config file in sites-available to sites-enabled?
3) What are the folders sites-available and sites-enabled for? Why have 2 different folders?

Question by:Victor Kimura
LVL 19

Accepted Solution

xterm earned 2000 total points
ID: 37060430
It doesn't sound very logical, but it is likely just an Apache include.  And having two folders is a good idea, because you can simply remove the symlink to disable one, but you don't have to delete the site config if you want to reenable it later.

Try doing a generic vhost like this, but creating a text file in /etc/apache2/sites-available called "domain.com" (which is the name of the domain that you want to set up.  Replace in this config with the IP address of your server.

ServerAdmin webmaster@domain.com
ServerName www.domain.com
ServerAlias domain.com
DocumentRoot /path/to/your/server/root
CustomLog /path/to/your/logdir/access_log combined
ErrorLog /path/to/your/logdir/error_log

Then do:

cd /etc/apache/sites-enabled && ln -s ../sites-available/domain.com domain.com

Be sure that domain.com and www.domain.com resolve to the IP address of your machine before you restart Apache, or they obviously won't work.

Author Closing Comment

by:Victor Kimura
ID: 37060789

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question