[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 769
  • Last Modified:

Access a website and the tespage is shown - What is the problem?

Hi,

I'm trying to setup a webserver in a Red Hat Linux (Pro 9.0) box using the service of DynDns.

I create a virtual host with the name server, say "www.xyz.com". This is a real registered domain name. This domain name has been delegated to the namne servers of DynDns.org. I also registered this domain name with DynDns to use its service. DynDns already informed me about the delegation of this domain name has been completed.

The web server starts succesfully on the server and I alrready tested it with different web pages on the localhost 127.0.0.1 and it runs perfectly.

I'd like to setup this domain name as a virtual host on this web server.  I've done the following steps:
-- Open Red Hat Start --> System Settings --> Server Settings --> HTTP Server ====> Aapche Configuration window pops up
-- In "Main" tab, I named the web server, say Apache-1, and inside "Addresses Available" area, I let "All avaiable addresses on port 80" stay as default
-- In "Virtual Host" tab, I did the following things:
*** In Basic Setup
--> Named the virtual host, say virhost1
--> Set the root document directory: /var/www/html/virhost1

*** In Host Information
--> Select "Name-Based Virtual Host"
--> IP Address: is set to 192.168.1.x (this is the dynamic IP address of this Linux box)
--> Server Name: is set to "www.xyz.com"

Then I access the router (a Linksys router) to forward all the requests coming to the port 80 of the router to the dynamic IP Address of the web server, i.e. 192.168.1.x

I also created a home page, named index.html and I placed it into the root document directory (/var/www/html/virhost1/)

When I tried to access the web site www.xyz.com via the Internet, I can only get the "Test Page", exactly the same thing when I test the Apache web server the first time. It doesn't go to the assigned directory.

Maybe I missed something during these steps, please help. Any help would be appreciated.

Thanks,

Rfr1tz
0
rfr1tz
Asked:
rfr1tz
  • 4
  • 4
  • 3
2 Solutions
 
ahoffmannCommented:
please check your httpd.conf, you should have:

NameVirtualHost *
<VirtualHost www.xyz.com:80>
    ServerName www.xyz.com
...
0
 
samriCommented:
I would agree with ahoffmann on that.

You could browse thru Apache docs on Virtual Hosting at http://httpd.apache.org/docs-2.0/vhosts/
And a stuff for NameVirtualHost : http://httpd.apache.org/docs-2.0/vhosts/name-based.html

By changing the NameVirtualHost to *, basically you are configuring the server to respond to all available interfaces/dns names.


cheers.
0
 
ahoffmannCommented:
oops, we either need *:80 for NameVirtualHost, or <VirtualHost www.xyz.com>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
samriCommented:
ahoffmann,

The * alone should be fine.  

http://httpd.apache.org/docs-2.0/vhosts/name-based.html#using

>> In the normal case where any and all IP addresses on the server should be used, you can use * as the argument to NameVirtualHost. If you're planning to use multiple ports (e.g. running SSL) you should add a Port to the argument, such as *:80.

0
 
rfr1tzAuthor Commented:
Hi ahoffmann and samri,

Thanks a lot for your suggestions.
I followed your help and updated the httpd.conf as follows:

//----------------

#
# Use name-based virtual hosting.
#
NameVirtualHost *

#
# Virtual hosts
#

# Virtual host Default Virtual Host
<VirtualHost *>
       ServerSignature email       
      DirectoryIndex  index.php index.html index.htm index.shtml
       LogLevel  warn
       HostNameLookups off
</VirtualHost>

# Virtual host xyz.com
<VirtualHost www.xyz.com:80>
       DocumentRoot /var/www/html/virhost1
       ErrorLog logs/xyz-error_log      
       ServerName www.xyz.com       
       TransferLog logs/xyz-access_log
       ErrorLog logs/xyz-error_log
</VirtualHost>

//------------------------

When I started the Apache with this updated conf, I got the following error:

//------------------------
[root@localhost root]# [Sun Aug 22 00:00:09 2004] [error] VirtualHost _default_:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
//------------------------

I' don't know what this error is above and how to fix it. Please help if you've any idea bout this?
Maybe I still missed some steps during the setup of this server.

Once again, thanks alot
 

Rfr1tz



0
 
ahoffmannCommented:
see my comment about correction ;-)

NameVirtualHost *
<VirtualHost www.xyz.com>
      ServerName www.xyz.com     
0
 
samriCommented:

That is a warning -- but does you apache start, and serving out pages?

Relook at ahoffman's comment.

Perhaps, you may want to try this insdead:

# default vhost for request not matching any vhost.
<VirtualHost *>
    ServerName  localhost
      ServerSignature email      
     DirectoryIndex  index.php index.html index.htm index.shtml
      LogLevel  warn
      HostNameLookups off
</VirtualHost>

# Virtual host xyz.com
<VirtualHost *>
      ServerName www.xyz.com
      ServerAlias  xyz.com
      DocumentRoot /var/www/html/virhost1
      ErrorLog logs/xyz-error_log    
      TransferLog logs/xyz-access_log
      ErrorLog logs/xyz-error_log
</VirtualHost>
0
 
rfr1tzAuthor Commented:
Hi ahoffmann and samri,

Thanks a lot for your further help on this issue.
I read the instructions of the Apache documents that you helped to provide and follow their examples. I also tried with what samri put out in the above comment.

When I started the web server (Apachectl start), the warning
//------------------------
[root@localhost root]# [Sun Aug 22 00:00:09 2004] [error] VirtualHost _default_:443 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
//------------------------

still appeared. I dont' know why I have removed all the "port" info from the Virtual Hosts directives but this "error" warning still appeared.
But the server seems still comes up.

Now when I try to access "www.domain1.com" over the Internet, it leads to another error:

//------------------------

Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
Hint: https://www.domain1.com/
--------------------------------------------------------------------------------
Apache/2.0.40 Server at www.domain2.biz Port 80

//-------------------------

Then if I tried to access the web site xyz.com, using the link that the log recommends https://www.domain1.com, the link leads to the Linksys router and aske me for the "userid" and " password" to access the router, exactly the same way if I want to access the router to do some configruation, using web browser. If I enter the userid and apssword, it leads to configuration pages of the router. And no way I can access the index.html file of the web site.

I tried to use configuration pages of Linksys router to disable the SSL feature if it was set but I couldn't find out any place that I could do this.

If you've some idea about what I need to do, please help.

Thanks again,

Rfr1tz

0
 
rfr1tzAuthor Commented:
Hi,

Sorry that both "domain1" and "domain2" should be replaced with "xyz" to have "www.xyz.com".

Thanks,

Rfr1tz
0
 
samriCommented:
If that is the case, the linksys administration is bound to port 80.

You would have to configure your webserver to use different port 8000 for example, and configure redirection on the linksys to forward traffic on port 80 to internal server pot 8000.

Or configure your linksys administration server to listen on other than 80, and adjust the firewall/redirection rule accordingly.  it would be slightly risky since anything wrong would cause your linksys administration webserver to be inaccessible -- you could restart the router if this happen.  Just make sure you don't save the config (commit would be fine!).

cheers,

0
 
rfr1tzAuthor Commented:
Hi smari and ahoffmann,

Thanks a lot for your patience in help me on this issue.
Your replies are excellent and accept them all. May either of you give me a bonus?

I just tried another way and found that if I remove all the virtual host directives, i.e. not set up virtual hosts, only let the web server serves 1 domain name and the index.html resides inside the default DocumentRoot directory "/var/www/html", everything is OK. I can access the web site correctly as expected. However, if I added virtual host directives back, then errors comes up.

It seemed to me that I made some mistakes, something I couldn't yet figure out, when I added the virtula host directives into the httpd.conf file. If any of you that has a sample of the httpd.conf file that conatains the virtual host directive, using name-based virtual host, and you know that this httpd.conf is working correctly with Apache web server, please give a copy of it. I think I can learn from the correct file and figure out what mistakes I made.

Thanks a lot for all the help,

Rfr1tz
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now