Solved

Domain Parking (2 domains, 1 website)

Posted on 2004-03-22
18
321 Views
Last Modified: 2010-03-04
Hello,

I have been looking for a solution to my problem all week, so I hope Experts Exchange can help me out.

I'm running about 8 domains on one IP attached to my Linux server with Apache and Plesk 5. I would like (example) domain.net to be an exact mirror of domain.com, not a redirect. I read this is called "domain parking".

I am fairly new to Apache, so I would really appreciate if someone could give me some detailed help on this one. Perhaps a step-by-step how-to.

I already tried something I found on the web:

pico /etc/httpd/conf/httpd.conf

Then, on the last line of httpd.conf, I added:

<VirtualHost 111.111.111.111>
ServerName www.domain.com
DocumentRoot /home/httpd/vhosts/domain.com/httpdocs
</VirtualHost>

<VirtualHost 111.111.111.111>
ServerName www.domain.net
DocumentRoot /home/httpd/vhosts/domain.com/httpdocs
</VirtualHost>

Both with valid IPs and paths of course.

Then i restarted httpd and named server. Didn't work. Domain.net was still unchanged.

Looking forward to hearing from anyone who thinks he/she has a solution. Again, it's a Linux server with Apache and Plesk.
0
Comment
Question by:rvdmei
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 7
18 Comments
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10650685
Did you forget the

 NameVirtualHost *

( or     NameVirtualHost 111.111.111.111 )

in your httpd.conf ?

See http://httpd.apache.org/docs/vhosts/name-based.html
0
 

Author Comment

by:rvdmei
ID: 10651176
I did. But now that I changed that, it still doesn't work.

It used to be:

#NameVirtualHost *

It's now:

NameVirtualHost *

<VirtualHost 111.111.111.111>
ServerName www.domain.com
DocumentRoot /home/httpd/vhosts/domain.com/httpdocs
</VirtualHost>

<VirtualHost 111.111.111.111>
ServerName www.domain.net
DocumentRoot /home/httpd/vhosts/domain.com/httpdocs
</VirtualHost>

And I restarted httpd again. Domain.net still shows the same website. There still is an account open for Domain.net in Plesk, is that okay or do I have to remove that?
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10651248
1. try to have a * after VirtualHost since you have only 1 IP ... moreover it will drop the 127.0.0.1 case (e.g. if local loop is used for your local acccesses it wont work :)

2. try to add ServerAlias, in this case you have only 1 VirtualHost  (you could remove it ... but let's try :)
    ServerName www.domain.com
    ServerAlias *.domain.net

But probably the 1. would have already fixed the pb :)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rvdmei
ID: 10651406
I tried both:

<VirtualHost *>
ServerName www.domain.com
ServerAlias *.domain.net
DocumentRoot /home/httpd/vhosts/domain.com/httpdocs
</VirtualHost>

Then I restarted httpd. Domain.net still remains the same.

Is placement of the code of importance? I have the VirtualHost code at the bottom of httpd.conf.

PS: When I restart httpd, I get this message:

Stopping httpd: [OK]
Starting httpd: [warn] module mod_frontpage.c is already added, skipping
[OK]

I assume that has nothing to do with this, but I thought I'd mention it anyway.
0
 

Author Comment

by:rvdmei
ID: 10651447
Do I need to have the domain installed in Plesk or is that of no importance? I deleted it but that doesn't make any difference, so I'll add it again.
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10651464
I don't think it is important that the code is at the bottom.
Your virtual hosts config is not taken into account

In your httpd.conf do you have somewhere

ServerName www.domain.com

Ok, try as root the command

httpd -S

it will list you the virtual config as it sees it
0
 

Author Comment

by:rvdmei
ID: 10651817
"In your httpd.conf do you have somewhere

ServerName www.domain.com"

No, just:

#ServerName localhost

httpd -S returns:

"Syntax error on line 14 of /etc/httpd/conf/httpd.include:
Invalid command 'php_admin_flag', perhaps mis-spelled or defined by a module not included in the server configuration"

Eek, sounds bad. I appreciate your support so far.
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10651833
So, add the

ServerName www.domain.com

and comment line 14 (put a # on top)
0
 

Author Comment

by:rvdmei
ID: 10652005
I added ServerName www.freestuffplaza.com and fixed line 14, but i keep getting syntax errors. I added some #'s again, but still getting syntax errors. "Invalid command 'PerlHandler', perhaps mis-spelled..etc" this time.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 10653301
silly question: do all your domains already resolve to the same IP?
0
 

Author Comment

by:rvdmei
ID: 10653402
Yes.
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10654768
I suggest you put back the original initial httpd.conf file, with just a few more lines (ServerName, NameVirtualHost, VirtualHost [with ServerAlias]) ; you probably inserted some bad chars in the current file, and it will be difficult to fix it.
0
 

Author Comment

by:rvdmei
ID: 10660986
I never changed the current file and when I just switched to a backup my host made all sites went down.

Maybe I should get this domain parking idea out of my head.
0
 

Author Comment

by:rvdmei
ID: 10661062
Current file = the httpd.conf file that came with the server when i ordered it.
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10663754
Actually it should not be that difficult :) Try to reinstall Apache
0
 

Author Comment

by:rvdmei
ID: 10665491
To me, that's difficult ;) In the meantime, I'm sure you've given the solution to the domain parking problem, on a normal working server that is. So I'll give you the points.

Thanks for the support.
0
 
LVL 10

Accepted Solution

by:
Mercantilum earned 500 total points
ID: 10667392
Reinstall Apache from scratch, and check the points we raised above in the new config.
Oh! Just an idea: would you have used a windows tool to edit the httpd.conf file and instead of LF you get CRLR at end of each line ?
(not sure apache cares but just incase)
0
 

Author Comment

by:rvdmei
ID: 10668178
I used Putty (ssh) to edit httpd.conf.
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question