[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Domain Parking (2 domains, 1 website)

Posted on 2004-03-22
18
Medium Priority
?
324 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
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

 

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 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

650 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