Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Multiple domain handling with Apache
New Posts  All Forums:Forum Nav:

Multiple domain handling with Apache

post #1 of 4
Thread Starter 
I'm trying to setup my webserver to direct domains. I just got bind and my httpd setup, and it's working fine, but I want to setup my server as such.

home > username > domain1.com domain2.com etc... > public_html

domain1.com & domain2.com would both be directories containing public_html directories. So if someone directed their browser to domain1.com, it would send them to:

/home/username/domain1.com/public_html/index.html

I've activated the individual user directories in my apache httpd.conf, but I'm not quite sure how to go about pointing domains around my server... alias? There must be a setting or simple way of doing this.

If you can give me an idea, link, or a phrase I should google to learn how, please do. Thanks guys.
Edited by Rook_ - 6/17/11 at 9:20pm
Halcyon
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel C2Q Q9650 ASUS Maximus II Formula eVGA GTX 285 SSC 2x2GB Corsair Dominator DDR2 1066 
Hard DriveOSMonitorKeyboard
500GB 7200 Samsung Windows 7 Ultimate x64 Samsung Syncmaster 2233SW Logitech Wave 
PowerCaseMouse
Corsair 850TX Coolermaster HAF 932 Logitech G5 
  hide details  
Reply
Halcyon
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel C2Q Q9650 ASUS Maximus II Formula eVGA GTX 285 SSC 2x2GB Corsair Dominator DDR2 1066 
Hard DriveOSMonitorKeyboard
500GB 7200 Samsung Windows 7 Ultimate x64 Samsung Syncmaster 2233SW Logitech Wave 
PowerCaseMouse
Corsair 850TX Coolermaster HAF 932 Logitech G5 
  hide details  
Reply
post #2 of 4
It's been a long time since I've used Apache, but it looks like it functions the same way as most other webservers: you separate everything by VirtualHosts.

Check out this link for some examples.
post #3 of 4
Have you setup vhost entries for the domains in httpd.conf?
You should have something like this for each domain
Code:
<VirtualHost *:80>
DocumentRoot /home/domain1.com/public_html
ServerName www.domain1.com

ServerAlias domain1.com
RewriteEngine on
RewriteCond %{HTTP_HOST}                !^www.domain1.com(:80)?$
RewriteRule ^/(.*)                      http://www.domain1.com/$1 [L,R=301]

CustomLog /var/log/httpd/domain1.log combined
ErrorLog /var/log/httpd/domain1_error_log
  <Directory "/home/domain1.com/public_html">
    allow from all
    Options -Indexes +FollowSymLinks
    AllowOverride All
  </Directory>
</VirtualHost>

If you have this, you need to set your DNS for your domain to point to your servers IP. This may be handled by your Domain Registrar or your hosting may have DNS servers that are being used. Quite a few different ways to do this. You can also edit your hosts file to have any local traffic for those domains routed to your server, but only would work for local traffic.
White TITAN
(16 items)
 
   
CPUMotherboardGraphicsRAM
intel core i7-3770k Asus Z77 Sabertooth EVGA GTX 780 SC ACX Corsair Dominator Platinum 16GB (2x8GB) 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro  WD Black Crucial M4 LG Blueray 
CoolingOSMonitorPower
Swiftech H220 (Stock cooler on while RMA :( ) Windows 7 64bit Dell 2311h Ultrasharp x 2 Corsair AX850 
CaseMouseMouse PadAudio
Fractal Design Define R4 White (w/ Window) Logitech G700 Razer Control Edition Sound Blaster ZxR 
CPUMotherboardGraphicsRAM
Intel 980x Asus Rampage iii Extreme EVGA GTX580 SLI Patriot Viper Xtreme 12GB DDR3 2000 (PC3 16000) 
Hard DriveHard DriveHard DriveOptical Drive
120GB Corsair Force Series 3 SSD WD Caviar Black 640GB Crucial M4 128GB SSD LG Black Blu-ray Drive SATA Model UH12LS28 
CoolingCoolingCoolingCooling
XSPC RX360 and RX120 Rads Watercool HeatKiller 3.0 Limited Edition Black ... XSPC Dual Bay Res with Swiftech MCP655 Pump Silver Shining Bitspower Compression Fittings 
CoolingCoolingCoolingCooling
PrimoFlex Pro LRT Black Tubing -1/2in. ID X 3/4in. 3x Gentle Typhoon 120mm Fan 1850RPM (AP-15)  1x Noiseblocker NB-BlackSilentPro PL-2 120mm Ul... Koolance VID-NX580 Full Cover GPU Waterblock x2 
OSMonitorKeyboardPower
Windows 7 Home Premium x64 Dell U2311 Ultrasharp x2 Max Keyboard Nighthawk X8 Semi-Custom - Mechani... Antec High Current Gamer 900W 
CaseMouseMouse PadAudio
Xigmatek Elysium Black Logitech G700 Razer Goliathus Creative Sound Blaster Recon3D Fatal1ty Pro 
  hide details  
Reply
White TITAN
(16 items)
 
   
CPUMotherboardGraphicsRAM
intel core i7-3770k Asus Z77 Sabertooth EVGA GTX 780 SC ACX Corsair Dominator Platinum 16GB (2x8GB) 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro  WD Black Crucial M4 LG Blueray 
CoolingOSMonitorPower
Swiftech H220 (Stock cooler on while RMA :( ) Windows 7 64bit Dell 2311h Ultrasharp x 2 Corsair AX850 
CaseMouseMouse PadAudio
Fractal Design Define R4 White (w/ Window) Logitech G700 Razer Control Edition Sound Blaster ZxR 
CPUMotherboardGraphicsRAM
Intel 980x Asus Rampage iii Extreme EVGA GTX580 SLI Patriot Viper Xtreme 12GB DDR3 2000 (PC3 16000) 
Hard DriveHard DriveHard DriveOptical Drive
120GB Corsair Force Series 3 SSD WD Caviar Black 640GB Crucial M4 128GB SSD LG Black Blu-ray Drive SATA Model UH12LS28 
CoolingCoolingCoolingCooling
XSPC RX360 and RX120 Rads Watercool HeatKiller 3.0 Limited Edition Black ... XSPC Dual Bay Res with Swiftech MCP655 Pump Silver Shining Bitspower Compression Fittings 
CoolingCoolingCoolingCooling
PrimoFlex Pro LRT Black Tubing -1/2in. ID X 3/4in. 3x Gentle Typhoon 120mm Fan 1850RPM (AP-15)  1x Noiseblocker NB-BlackSilentPro PL-2 120mm Ul... Koolance VID-NX580 Full Cover GPU Waterblock x2 
OSMonitorKeyboardPower
Windows 7 Home Premium x64 Dell U2311 Ultrasharp x2 Max Keyboard Nighthawk X8 Semi-Custom - Mechani... Antec High Current Gamer 900W 
CaseMouseMouse PadAudio
Xigmatek Elysium Black Logitech G700 Razer Goliathus Creative Sound Blaster Recon3D Fatal1ty Pro 
  hide details  
Reply
post #4 of 4
Thread Starter 
Thanks guys "VirtualHosts" was the keyword I was looking for. I couldn't figure out what that system was called.

Thanks for your help. +rep
Halcyon
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel C2Q Q9650 ASUS Maximus II Formula eVGA GTX 285 SSC 2x2GB Corsair Dominator DDR2 1066 
Hard DriveOSMonitorKeyboard
500GB 7200 Samsung Windows 7 Ultimate x64 Samsung Syncmaster 2233SW Logitech Wave 
PowerCaseMouse
Corsair 850TX Coolermaster HAF 932 Logitech G5 
  hide details  
Reply
Halcyon
(13 items)
 
  
CPUMotherboardGraphicsRAM
Intel C2Q Q9650 ASUS Maximus II Formula eVGA GTX 285 SSC 2x2GB Corsair Dominator DDR2 1066 
Hard DriveOSMonitorKeyboard
500GB 7200 Samsung Windows 7 Ultimate x64 Samsung Syncmaster 2233SW Logitech Wave 
PowerCaseMouse
Corsair 850TX Coolermaster HAF 932 Logitech G5 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Linux, Unix
Overclock.net › Forums › Software, Programming and Coding › Operating Systems › Linux, Unix › Multiple domain handling with Apache