Portal Home > Knowledgebase > Articles Database > How to make an alias in httpd.conf


How to make an alias in httpd.conf




Posted by redtail, 02-22-2010, 01:25 PM
I'm on a VPS with CentOS Linux. On my VPS I have created several accounts with WHM. The roots of these are for instance: /home/account_one/public_html/ -> domain_one.com /home/account_two/public_html/ -> domain_two.com Is it possible in httpd.conf to make /home/account_two/public_html/ the alias of /home/account_one/public_html/ so that domain_two.com serves the same pages/scripts as domain_one.com ? And if this is possible, how can I do it? Would it be something like the following?

Posted by david510, 02-23-2010, 02:51 AM
If you need each domain serve from single location ie from /home/user/public_html , you need to make ServerAlias for each domain on the parent domain. Consider you have created domain.com and uploaded all files. Of you need need domain1.com and domain2.com to resolve from the same location as of domain.com, you need to add the following lines in the virtualhost section of domain.com. Run the following command after this.

Posted by redtail, 02-23-2010, 05:01 PM
Thank you davie510. However, I'm a total newbie at this. Where can I find this virtualhost section? Is this a file in the root of the domain? Will this work even if both domains are in separate user accounts on the server on two different IP addresses?

Posted by techstar, 02-24-2010, 01:58 AM
Hi, you can try some other option like this: Since you have the WHM you can simply park(using the cpanel) the domain domain_two.com to domain_one.com. The both pages will display the same content. And if one domain is parked there is no meaning in keeping that account in the server. You can simply delete it and save one dedicated IP also.

Posted by david510, 02-24-2010, 05:13 AM
I you do no have exp in shell and configurations, use cpanel park domain feature. When you add park domains from the cpanel, the httpd.conf file gets modified in the manner I explained to you.

Posted by redtail, 02-24-2010, 09:43 AM
I do have access to shell and configurations and would like to learn how to do this. My goal is to have two domains on two different IP addresses with one serving exactly the same content as the other. Currently I have set this up in two accounts on my VPS: /home/account_one/public_html/ -> domain_one.com /home/account_two/public_html/ -> domain_two.com These are on different IP addresses and each have their own cPanel. How can I best configure this?

Posted by david510, 02-24-2010, 10:22 AM
Does each domain needs individual IPs? Can you put them on a single IP?

Posted by redtail, 02-24-2010, 10:46 AM
Yes, my client wants each of the two domains on a separate ip address ... Is that possible with virtualhost or serveralias?

Posted by david510, 02-24-2010, 10:53 AM
Change the document root of domain_two.com to /home/account_one/public_html in the virtualhost section inside httpd.conf file and restart apache. search foe the line www.domain_two.com. You can see it will be inside the VH section of domain_two.com. From here edit the line starting with "DocumentRoot" as mentioned above. Save this file and restart apache. Run distiller

Posted by LeaTrueman, 02-24-2010, 11:10 AM
Hello, If you want to get same pages for both the domains domain_one.com and domain_two.com , then a simple parking from WHM will do this for you. WHM >> Park a domain

Posted by redtail, 02-24-2010, 05:54 PM
Thank you david510. I tried to do this: 1. I updated the Document Root for domain_two.com in /usr/local/apache/conf/httpd.conf 2. I tried "service httpd restart" but got an error so I did this in WHM 3. Then I tried "/usr/local/cpanel/bin/apache_conf_distiller --update" but got the following error: Now when I go to domain_two.com I get an internal server error though.

Posted by redtail, 02-24-2010, 10:16 PM
I had a look at the error_log and it looks like the 500 Internal Server Errors are caused by: Any idea how I can fix this? If I change the DocumentRoot back to the original it works fine.

Posted by david510, 02-25-2010, 01:06 AM
You have enabled SuEXEC on the apache. Try disabling it for these domains.

Posted by LeaTrueman, 02-25-2010, 05:21 AM
WHM >> Configure PHP and SuExec >> Apache suEXEC >> no >> Save new configuration

Posted by redtail, 02-25-2010, 09:09 AM
Thank you so much for all your help. I turned off Apache suEXEC in PHP and SuExec Configuration but still get the 500 Internal Server Errors. Error_log still says "Mismatch between target UID (504) and UID (505)". PHP 5 Handler is set to "suphp", should that be changed?

Posted by Cynthia Blue, 08-25-2010, 11:52 AM
I've been battling similar problems. I changed the PHP5 handler to CGI and it seems my problems are now gone.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
mp4 video streaming. (Views: 793)
How to install CURL? (Views: 799)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.