Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running a CentOs 5.5 server and wanted to know what commands I needed to run to be able to do the following;

I have 3 domains on the server - example1.com, example2.com, example3.com

I wanted to set up in conf so that the file contents of each domain are in different directories, so that I can upload 3 completely different sites using the one server.

ie: /home/site1/ would be the upload dir for example1.com, /home/site2/ would be for example2.com, etc.

If someone could help me with a line by line for terminal it would be very much appreciated!
Thank you!

share|improve this question
Do you have each domain on its own IP address? – Ignacio Vazquez-Abrams Oct 11 '11 at 5:31
@Ignacio Vazquez-Abrams: Each domain is on the same server, using the same IP. – Andy Oct 11 '11 at 7:11
CentOS 5.5 is well beyond EoL. If you want to keep current with the apache httpd 2.2 you will need an upgrade to CentOS 5.7. The RedHat Upstream repos will contain security fixes for httpd that are not even released in apache.org for the most current stable release. – Nils Oct 11 '11 at 21:07
Set up in what conf? By “file contents”, do you mean what will show up on the various websites you are serving? What protocol(s) are you uploading with? What program will process the uploaded files? – Gilles Oct 11 '11 at 23:49

In general, you can't. HTTP can support multiple domain names on the same IP address since HTTP 1.0's addition of the Host header; most other services (SSH, FTP, etc.) have no equivalent and therefore can't differentiate access via one domain name from another and therefore don't support per-domain name settings.

share|improve this answer

Looks like name based virtual hosting to me. If I remember it right:

  • Listen IP:80
  • UseCanonicalName yes
  • NameVirtualHost example1.com
  • NameVirtualHost example2.com
  • NameVirtualHost example3.com

For each of your VirtualHosts define a VHOST-Section using exampleN.com as name with at least the following settings within each VHOST:

  • Name exampleN.com
  • DocumentRoot /home/siteN
  • Allow read access to that directory from anywhere

Just drop a comment if you need further information - then I will look it up on one of my multi-homed-servers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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