Server Fault is a question and answer site for system and network administrators. 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 want to create a local web server and different domains for eg.,, etc.I installed LAMP in CentOS 5.4. The problem is i am not able to configure ssh username and password for each of my subdomain.I want to keep a single document root for each subdomain. can anybody explain the whole process of setting a local web server with multiple subdomain having unique ssh username and password with common document root.

share|improve this question
up vote 3 down vote accepted


"create a local web server and different domains for eg.,,"

Set up virtual hosts on the Apache httpd server. Edit httpd.conf:

NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot /www/apple

<VirtualHost *:80>
  DocumentRoot /www/abc

<VirtualHost *:80>
  DocumentRoot /www/xyz


"configure ssh username and password for each of my subdomain"

First, set up users to maintain the content of each site. There are a number of ways of handling this. One way would be to make apache serve each site from a subdirectory of each users home directory. Another way would be to put a softlink from the user's home directory to the docroot directory of the corresponding site.

useradd ... mary
mkdir /www/apple
chown mary /www/apple
ln -s /www/apple ~mary/html

useradd ... fred
mkdir /www/abc
chown fred /www/abc
ln -s /www/abc ~fred/html

useradd ... pete
mkdir /www/xyz
chown pete /www/xyz
ln -s /www/xyz ~pete/html

Then you set up ssh in the usual way. When Mary, Fred or Pete log in they can cd html and edit the content for the website they have responsibility,,

share|improve this answer

also put entries in hosts file for each domain to point to your server

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.