Apache

stpvoice

Community Support Rep
Community Support
Messages
5,987
Reaction score
212
Points
63
Anyone know how to set an apache installation to listen for subdomains, as well as the root domain??

Any help would be appreaciated.
 

vishal

-::-X10 Guru-::-
Community Support
Messages
5,255
Reaction score
192
Points
63
For this u have to edit /etc/http/conf/httpd.conf

Then here is eg how to do it
a. enable name virtual hosting on the ip
NameVirtualHost 192.100.0.X
b. First site: stationx.example.com
<VirtualHost stationx.example.com >
ServerName stationx.example.com
DocumentRoot /var/www/abc/
DirectoryIndex index.html
ServerAdmin root@ stationx.example.com
ErrorLog logs/error_abc.logs
CustomLog logs/custom_abc.logs common
</VirtualHost>
c. Second site: wwwx.example.com
<VirtualHost wwwx.example.com>
ServerName wwwx.example.com
DocumentRoot /var/www/example/
DirectoryIndex index.html
ServerAdmin root@stationx.example.com
ErrorLog logs/error_example.logs
CustomLog logs/custom_example.logs common
</VirtualHost>
2. service httpd start| restart
3. chkconfig httpd on
4. links wwwx.example.com
6. links stationx.example.com
For Name based Virtual Hosting, we should specified the IP address on which we
are going to host the multiple sites using NameVirtualHost options.
• ServerName means you FQDN, already lookup on DNS
• DirectoryRoot path for web documents for this site.
• DirectoryIndex default page for websites.
 
Top