Go Back   Technibble Forums > Operating Systems > Linux

  Technibble Sponsor

Reply
 
Thread Tools Display Modes
  #1  
Old 03-19-2012, 01:24 AM
tankman1989's Avatar
tankman1989 tankman1989 is offline
 
Join Date: Apr 2009
Posts: 2,077
tankman1989 is on a distinguished road
Question Setting up Virtual Hosts in Apache2 - What a headache!

I'm having a hard time wrapping my head around this. I did this once before but now I' stuck. I found 3 decent sites explaining how to do this:

http://ubuntu-tutorials.com/2008/01/...rtual-hosting/
http://www.ubuntugeek.com/howto-crea...in-apache.html
http://blog.code4hire.com/2011/03/se...l-development/

The problem is that there are tiny differences between them and I can't reconcile these differences. Does anyone here know how to do this and can give me pointer?

This is the line that is snaggin me on the file: /etc/apache2/sites-available/new_virtual_host_site_name
Quote:
Add ServerName our-test-site.local just above the DocumentRoot directive (in front of line 4).

Edit DocumentRoot /var/www path on line 4 and set it to /path-to-the-test-site-WITHOUT-trailing-slash.
It should look something like this:
DocumentRoot /path-to-the-test-site-WITHOUT-trailing-slash
Ok so here is what I want to do. I am naming my site "ICS". I created the folder in /var/www/ics/ as I think this is where the data is going to be stored. This means that the file I'm editing is:
Quote:
/etc/apache2/sites-available/ICS
When I need to add the line to the above file do what do I use as the TLD (.local, .com, .net, etc?) This is what is different in each how-to's that is very comfusing. Most have .com but would that interfere with the real site on the internet that has the same domain name? How does it know to stay local?
ServerName ICS
Reply With Quote
  #2  
Old 03-19-2012, 09:59 AM
coreyspeed coreyspeed is offline
 
Join Date: Mar 2010
Location: Hertfordshire, UK
Posts: 245
coreyspeed is an unknown quantity at this point
Default

The sites-avaliable directoy is where you place the file with the virtual hosts config in. apache loads all the site from that directory.

to create a local domain use .local and either add the ip and domain to your hosts file or to your router (not sure on which part think its DNS). if you post what you have currently we can look through the settings.
Reply With Quote
  #3  
Old 03-20-2012, 01:56 AM
mouse mouse is offline
 
Join Date: Oct 2010
Location: San Diego
Posts: 18
mouse is an unknown quantity at this point
Default

You need to add the configuration file in the sites-available directory, then create a sym link to the sites-enabled directory, as this is where apache looks for sites that are enabled. If you are just messing with it locally you can use any extension just point it locally in the host file or the DNS if you use one. Look at the Apache documentation for examples of what the configuration file should look like at its most basic to work http://httpd.apache.org/docs/2.0/vhosts/examples.html
Reply With Quote
  #4  
Old 12-04-2012, 05:28 PM
BM-Networking's Avatar
BM-Networking BM-Networking is offline
 
Join Date: May 2011
Location: Fresno, Ca
Posts: 92
BM-Networking is an unknown quantity at this point
Send a message via Skype™ to BM-Networking
Default

I know I'm way late on this one, but through I'd post an answer anyways for others...

You can have your site in any folder, not just the /var/www/ics directory, you just need to change the location in the conf file. I usually place my sites in /home/www/ics.

The .net .local .com, etc... will be added to the config file under ServerName.

Then ensure the folder has the proper permission by running the following:

Code:
chown -R www-data:www-data /var/www/ics
Once that is done, you can enable the site by running this command

Code:
a2ensite ICS
Then restart or reload Apache.

Code:
service apache2 restart or /etc/init.d/apache2 restart
__________________
Brian



Network Consulting & Computer Repair in Fresno, Ca
Reply With Quote
  #5  
Old 12-04-2012, 07:07 PM
krtechsolutions's Avatar
krtechsolutions krtechsolutions is offline
 
Join Date: Oct 2010
Posts: 496
krtechsolutions is on a distinguished road
Default

download and install webmin
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Technibble.com is based out of MELBOURNE, AUSTRALIA.