• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

Domain Parking (2 domains, 1 website)

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
rvdmei
Asked:
rvdmei
  • 10
  • 7
1 Solution
 
MercantilumCommented:
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
 
rvdmeiAuthor Commented:
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
 
MercantilumCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
rvdmeiAuthor Commented:
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
 
rvdmeiAuthor Commented:
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
 
MercantilumCommented:
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
 
rvdmeiAuthor Commented:
"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
 
MercantilumCommented:
So, add the

ServerName www.domain.com

and comment line 14 (put a # on top)
0
 
rvdmeiAuthor Commented:
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
 
ahoffmannCommented:
silly question: do all your domains already resolve to the same IP?
0
 
rvdmeiAuthor Commented:
Yes.
0
 
MercantilumCommented:
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
 
rvdmeiAuthor Commented:
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
 
rvdmeiAuthor Commented:
Current file = the httpd.conf file that came with the server when i ordered it.
0
 
MercantilumCommented:
Actually it should not be that difficult :) Try to reinstall Apache
0
 
rvdmeiAuthor Commented:
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
 
MercantilumCommented:
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
 
rvdmeiAuthor Commented:
I used Putty (ssh) to edit httpd.conf.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 10
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now