LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   website showing ipaddress (https://www.linuxquestions.org/questions/linux-newbie-8/website-showing-ipaddress-906190/)

mlnm 10-03-2011 08:55 AM

website showing ipaddress
 
i created a apache web server and hosted website in it , website is working fine but when resolving it shows ip address.
Please tell me how i can avoid it.
these are the details:
Server : RHEL5
port forwarding : port 80 has been forwarded.
Server is having public ip address.

tronayne 10-03-2011 09:07 AM

In your index.html file you put a <title> in the <head> section. Something like
Code:

<head>
<title>This is displayed instead of the IP address</title>
</head>

Might be useful to find a HTML tutorial.

Or, in your httpd.conf file give the server a name:
Code:

ServerName name.what:80
Hope this helps some.

mlnm 10-03-2011 03:22 PM

i have done all u suggested but nothing has changed ,
when i type my website name from browser (cypherlogics.com) , and press enter it shows the content but in address bar it shows ip address instead of website name

tronayne 10-03-2011 04:29 PM

Well, yup, it does show the address.

Your page source is
Code:

<html>
<title> Welcome to cypherlogis.com </title>
<body>
<font size=7>
<b>THIS SITE IS UNDER CONSTRUCTION</b>
</body>
</html>

You're missing
Code:

<html>
<header>
<title> Welcome to cypherlogis.com </title>
</header>

Did you stop and restart HTTPD after you added
Code:

ServerName cypherlogis.com:80
Anytime you make a change in your httpd.conf file, you need to stop and restart the daemon.

Hope the helps some.

michaelk 10-03-2011 05:40 PM

Web browsers display the title in a window’s title bar when the window is open, and in the task bar when the window is minimized. The title has nothing to do with the URL but severname is most likely the problem.

Check your httpd.conf. My first guess is if you have the directive UseCanonicalName set to on the URL will be whatever is set for the servername. If off whatever is supplied by the client. If no server name is defined the default AFAIK is the IP address.

tronayne 10-04-2011 08:04 AM

Here's the default ServerName section of httpd.conf:
Code:

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

You probably should set that as
Code:

ServerName www.cypherlogics.com:80
It seems that you do have a registered DNS name (I can get to your server with http://cypherlogics.com) and when it connects I see the IP address).

As michaelk suggests, the default setting for UseCanonicalName is
Code:

#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client.  When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName Off

You probably want to check that and set it On if it's not.

Don't forget to stop and restart HTTPD (the daemon) -- and, when you connect you might want to clear your browser's cache (or "force reload the page"); sometimes the browser cache can trip you up even though you've fixed the problem you won't see it without a force reload or cache clear.

Hope this helps some.

mlnm 10-04-2011 12:32 PM

No friends i tried putting usecononicaName but did'nt work out , i tried changing my html file also but no solution.
i already mentioned that i have port forwarded 80 in my router i think it is the problem but without port forwarding site will not open because the router has a dhcp pool for local systems.
what i mean is my router has public ip but my servers address is dhcp ipaddress.


All times are GMT -5. The time now is 10:22 AM.