Solved

Domain Parking (2 domains, 1 website)

Posted on 2004-03-22
18
317 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
  • 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
 

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now