LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   site only works with www. in front of domain name (https://www.linuxquestions.org/questions/linux-server-73/site-only-works-with-www-in-front-of-domain-name-938818/)

B-Rye 04-08-2012 10:10 PM

site only works with www. in front of domain name
 
DOMAIN #1 setup and working when i took over the server
- works with and without www.
- /home/domain1/public_html

DOMAIN #2 just setup
- works with www.
- without the www. gives generic cgi - apache is working page urlshows up as domain2.com/cgi-sys/defaultwebpage.cgi
- /home/domain2/public_html



httpd.conf
----------


NameVirtualHost serverip:80


# THIS IS WORKING PERFECTLY BOTH WITH AND WITHOUT THE WWW.
# was adding by old IT guy
<VirtualHost serverip:80>
ServerName domain1.com
ServerAlias www.domain1.com
DocumentRoot /home/domain1/public_html
ServerAdmin admin@here.com
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/domain1.com combined
CustomLog /usr/local/apache/domlogs/domain1.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
<IfModule !mod_disable_suexec.c>
SuexecUserGroup domain1 domain1
</IfModule>
ScriptAlias /cgi-bin/ /home/domain1/public_html/cgi-bin/
</VirtualHost>


# WORKING WITH WWW. W/O GOES TO GENERIC CGI - APACHE IS WORKING PAGE
#added by me
<VirtualHost serverip:80>
ServerName www.domain2.com
ServerAlias domain2.com
DocumentRoot /home/domain2/public_html
ServerAdmin admin@here.com
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/domain2.com combined
CustomLog /usr/local/apache/domlogs/domain2.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
<IfModule !mod_disable_suexec.c>
SuexecUserGroup domain2 domain2
</IfModule>
ScriptAlias /cgi-bin/ /home/domain2/public_html/cgi-bin/
</VirtualHost>


I'm confused as to where to go from here.

kbp 04-09-2012 07:18 AM

How did you configure the dns records ?

273 04-09-2012 08:19 AM

I think you gave your ServerName ans ServerAlias mixed up for the second server.

B-Rye 04-09-2012 08:53 AM

This is what he had for the working domain.
I just edited this file for the 2nd domain.




; cPanel first:11.30.6.6 (update_time):1333933079 Cpanel::ZoneFile::VERSION:1.3 hostname:ims.theplanet.com latest:11.30.6.6
; Zone file for domainhere.com
$TTL 14400
domainhere.com. 86400 IN SOA ns1.ournameserverhere.com. emailhere. (
2012040901 ;Serial Number
86400 ;refresh
7200 ;retry
3600000 ;expire
86400 ;minimum
)

domainhere.com. 86400 IN NS ns1.nameserver.com.
domainhere.com. 86400 IN NS ns2.nameserver.com.
domainhere.com. 86400 IN NS ns2.nameserver.com.
domainhere.com. 86400 IN NS ns1.nameserver.com.


domainhere.com. 14400 IN A ourip

localhost 14400 IN A 127.0.0.1

domainhere.com. 14400 IN MX 0 domainhere.com.

mail 14400 IN CNAME domainhere.com.
www 14400 IN CNAME domainhere.com.
ftp 14400 IN A iphere
test 14400 IN A iphere
www.test 14400 IN A iphere
cpanel 14400 IN A iphere
whm 14400 IN A iphere
webmail 14400 IN A iphere
webdisk 14400 IN A iphere
maintenance 14400 IN A iphere
www.maintenance 14400 IN A iphere

B-Rye 04-09-2012 08:55 AM

Quote:

Originally Posted by 273 (Post 4648308)
I think you gave your ServerName ans ServerAlias mixed up for the second server.

I was messing around to see if it reversed my problem. it does not seem to make a difference

suj 04-17-2012 01:23 AM

Hi,

Double check that you have specified same ip in <VirtualHost serverip:80> (in apache conf) and in your domain A record.

Create a test file in public_html directory and access it via web browser. Is it loading fine..?

cliffordw 04-17-2012 11:44 AM

Did you change the DNS entry for www.domain2.com recently? Your TTL seems to be 4 hours, so if this was changed more recently than that, you could still have an old old value cached by your client machine.


All times are GMT -5. The time now is 12:11 AM.