LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   website Server Alias (https://www.linuxquestions.org/questions/linux-server-73/website-server-alias-668595/)

M_C 09-09-2008 04:03 AM

website Server Alias
 
hey!
could some one help troubleshoot
i need to be able to open my website without necessarily placing a www. in the address bar
configs below


@ IN SOA ns1.m.com. admin.m.com. (

20070932 ;
3h ;
1h ;
1w ;
10h ) ;

IN NS ns1.m.com.
IN NS ns2.m.com.

IN MX 10 smtp.m.com.


IN A 1.1.1.1 ****is this the problem ? what does this acheive?

ns1 IN A 1.1.1.1
ns2 IN A 2.2.2.2


www IN A 3.3.3.3
smtp IN A 4.4.4.4
ns1 IN A 1.1.1.1
ns2 IN A 2.2.2.2




my vhosts file for the website is as follows

<VirtualHost 3.3.3.3:80>
ServerAdmin admin@m.com
ServerName www.m.com
ServerAlias m.com
DocumentRoot /www//html
ScriptAlias /cgi-bin/ /www//html/cgi-bin/
ErrorLog /www//logs/error_log
</VirtualHost>


if i ping m.com it resolves to ns1.m.com
if i put www.m.com the website site opens
however i would like to be able to put m.com in the address bar without the www and have it resolve the to the website.


thanks

bathory 09-09-2008 04:10 AM

You should add
Code:

@ IN A 3.3.3.3
in the zone file, increase serial and reload zone. From the apache part you're OK.

Regards

M_C 09-09-2008 06:03 AM

thanks for the quick response
adding 3.3.3.3 allows me to resolve *.m.com e.g m.m.com however it does not resolve for m.com without the anything before the m, any more suggestions

thanks

bathory 09-09-2008 06:33 AM

@ is the origin record and it should be the same as the domain name. You can use
Code:

m.com. IN A 3.3.3.3
to achieve the same result. You have to remove "IN A 1.1.1.1" if you want your domain to resolve in 3.3.3.3 as your www

M_C 09-09-2008 09:19 AM

i'm thinking the problem is with the alias,
here's why : - i have several vhosts files and even after removing IN A 1.1.1.1 it will still resolve *.m.com and not m.com
any other ideas

thanks

bathory 09-09-2008 09:34 AM

The ServerAlias in your vhost is correct. What is the output of:
Code:

nslookup m.com
nslookup www.m.com


trickykid 09-09-2008 12:36 PM

Also I always make the ServerAlias in the httpd.conf file as the www or *.domain.com like:

Code:

<VirtualHost 3.3.3.3:80>
ServerAdmin admin@m.com
ServerName m.com
ServerAlias www.m.com
DocumentRoot /www//html
ScriptAlias /cgi-bin/ /www//html/cgi-bin/
ErrorLog /www//logs/error_log
</VirtualHost>


M_C 09-10-2008 03:03 AM

here's the output
a ping will use round robin and to resolve *.m.com but not m.com neither will the page load
m.com
i'll need to look into this closer away from the production server


[root@webs vhosts]# nslookup m.com
Server: 2.2.2.2
Address: 1.1.1.1#53

Name: m.com
Address: 2.2.2.2



[root@webs vhosts]# nslookup www.m.com
Server: 2.2.2.2
Address: 1.1.1.1#53

Name: m.com
Address: 2.2.2.2

M_C 09-17-2008 07:55 AM

is it possible to ping a server alias ?
how do i go about testing this ?

bathory 09-17-2008 08:20 AM

Of course you can ping a server alias, since it resolves to a valid IP address.
What I don't understand is the output of the nslookup commands in your previous post. How can "Server" and "Address" be different? How about running nslookup using the dns IP:
Code:

nslookup m.com 1.1.1.1
nslookup www.m.com 1.1.1.1



All times are GMT -5. The time now is 07:44 AM.