Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I want to create a local web server and different domains for eg. apple.com,abc.apple.com,xyz.apple.com 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

2 Answers 2

up vote 3 down vote accepted

1

"create a local web server and different domains for eg. apple.com,abc.apple.com,xyz.apple.com"

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

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName apple.com
  DocumentRoot /www/apple
</VirtualHost>

<VirtualHost *:80>
  ServerName abc.apple.com
  DocumentRoot /www/abc
</VirtualHost>

<VirtualHost *:80>
  ServerName xyz.apple.com
  DocumentRoot /www/xyz
</VirtualHost>

2

"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 for.apple.com,abc.apple.com,xyz.apple.com

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

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.