LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-22-2004, 01:37 AM   #1
treotan
Member
 
Registered: Jun 2004
Posts: 126

Rep: Reputation: 15
How to setup the virtualhost in home?


Hi!

I have a fedora machine and broadband connection; I want using the ip to host the two domain name and point to the different directory.

Now I hosting a one domain name, is work!

What do I need to modify? domain name forwarding....

IP based or name based virtual host???
 
Old 07-22-2004, 01:46 AM   #2
hallamigo
Member
 
Registered: Feb 2004
Location: Utah, USA
Distribution: Debian
Posts: 230

Rep: Reputation: 31
You do multiple domains using 1 IP with Virtual Hosting through Apache Web Server - I'm currently running over 25 domains per one IP address.

Read the following on how to configure your httpd.conf file for Apache.

http://httpd.apache.org/docs/vhosts/index.html
 
Old 07-22-2004, 02:17 AM   #3
treotan
Member
 
Registered: Jun 2004
Posts: 126

Original Poster
Rep: Reputation: 15
Thanks

what is you using IP based or Name based?
 
Old 07-22-2004, 02:25 AM   #4
hallamigo
Member
 
Registered: Feb 2004
Location: Utah, USA
Distribution: Debian
Posts: 230

Rep: Reputation: 31
Name based
 
Old 07-22-2004, 02:33 AM   #5
treotan
Member
 
Registered: Jun 2004
Posts: 126

Original Poster
Rep: Reputation: 15
OK I tried and only changed as following:

NameVirtualHost XXX.XX.XXX.XX

<VirtualHost XXX.XX.XXX.XX>
ServerName www.domain1.com
DocumentRoot /var/www/html/domain1
</VirtualHost>

<VirtualHost XXX.XX.XXX.XX>
ServerName www.domain2.com
DocumentRoot /var/www/html/domain2
</VirtualHost>

and "service httpd restart"


But I typed www.diomain2.com it was forward to the original place! It didn't change!!!
 
Old 07-23-2004, 03:33 PM   #6
hallamigo
Member
 
Registered: Feb 2004
Location: Utah, USA
Distribution: Debian
Posts: 230

Rep: Reputation: 31
Here is an example of what I have.

Code:
NameVirtualHost *:80

<VirtualHost *:80> 
    DocumentRoot /usr/local/apache/htdocs/site1
    ServerName www.site1.com
    ServerAlias site1.com
    ErrorLog /usr/local/apache/logs/site1-error_log
    CustomLog /usr/local/apache/logs/site1-access_log combined
</VirtualHost>

<VirtualHost *:80> 
    DocumentRoot /usr/local/apache/htdocs/site2
    ServerName www.site2.com
    ServerAlias site2.com
    ErrorLog /usr/local/apache/logs/site2-error_log
    CustomLog /usr/local/apache/logs/site2-access_log combined
</VirtualHost>
 
Old 08-04-2004, 10:18 PM   #7
treotan
Member
 
Registered: Jun 2004
Posts: 126

Original Poster
Rep: Reputation: 15
Listen 80
Listen 8080

NameVirtualHost HOME_IP:80
NameVirtualHost HOME_IP:8080

<VirtualHost HOME_IP:80>
ServerName domain1.hk
ServerAlias *.domain1.hk
DocumentRoot /var/www/html/domain1
ErrorLog /var/www/hml/logs/domain1-error_log
CustomLog /var/www/html/logs/domain1-access_log combined
</VirtualHost>

<VirtualHost HOME_IP:8080>
ServerName www.domain2.com
ServerAlias *.domain2.com
DocumentRoot /var/www/html/domain2
ErrorLog /var/www/html/logs/domain2-error_log
CustomLog /var/www/html/logs/domain2-access_log combined
</VirtualHost>

It can't be work property, it only forward to Documentroot; it seem the virtualhost didn't been work!!

What I need to modify? Do I need change the config. about the domain parking service?


 
Old 08-04-2004, 10:26 PM   #8
Ryan0rZ
LQ Newbie
 
Registered: Aug 2004
Location: Mid-Michigan
Distribution: Debian, Mandrake
Posts: 11

Rep: Reputation: 0
Why are you using port 8080 for the second domain? Try using something like this:

Code:
Listen 80

NameVirtualHost *:80

<VirtualHost *:80>
ServerName domain1.hk
ServerAlias *.domain1.hk
DocumentRoot /var/www/html/domain1
ErrorLog /var/www/hml/logs/domain1-error_log
CustomLog /var/www/html/logs/domain1-access_log combined
</VirtualHost>

<VirtualHost *:80>
ServerName www.domain2.com
ServerAlias *.domain2.com
DocumentRoot /var/www/html/domain2
ErrorLog /var/www/html/logs/domain2-error_log
CustomLog /var/www/html/logs/domain2-access_log combined
</VirtualHost>
I assume there's a reason you changed it from the original, why was that? Unless you were going to http://domain2.com:8080/ it looks like it would just jump to the first one, on port 80. Were you trying to distinguish between the two domains by port number? If so, it's unneccisary. Apache can handle it from the HTTP Request.
 
Old 08-04-2004, 10:47 PM   #9
treotan
Member
 
Registered: Jun 2004
Posts: 126

Original Poster
Rep: Reputation: 15
I modified! It is same, is not change effective!!

I try typed httpd -S:

[root@localhost conf]# httpd -S
VirtualHost configuration:
HOME_IP:80 is a NameVirtualHost
default server thespot.hk (/etc/httpd/conf/httpd.conf:1053)
port 80 namevhost domain1.hk (/etc/httpd/conf/httpd.conf:1053)
port 80 namevhost www.domain2.com (/etc/httpd/conf/httpd.conf:1061)
wildcard NameVirtualHosts and _default_ servers:
_default_:443 localhost.localdomain (/etc/httpd/conf.d/ssl.conf:99)
Syntax OK
 
Old 08-05-2004, 09:31 AM   #10
Erebus Bat
LQ Newbie
 
Registered: Jul 2004
Distribution: Ubuntu 10.04 (Lucid)
Posts: 25

Rep: Reputation: 15
You can look at my notebook I made for when I set up my virtual hosts:

I explain why each tag is there.

http://www.batcavern.com/linux/httpdvhosts.html
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtualhost setup on apache 2 notmatt Debian 2 10-28-2004 01:05 PM
Setup network at home?? Pedroski Linux - Hardware 1 04-24-2004 09:17 AM
how do I setup a home network? Lindy Linux - Networking 4 12-09-2003 03:15 PM
How to Setup Firewall for home network julesbrat Linux - Networking 1 05-19-2002 03:17 PM
Did @HOME change its setup? tarballedtux Linux - Networking 0 02-09-2002 09:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration