Solved

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

Posted on 2004-08-20
11
760 Views
Last Modified: 2010-03-04
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
Comment
Question by:rfr1tz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
11 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 150 total points
ID: 11858403
please check your httpd.conf, you should have:

NameVirtualHost *
<VirtualHost www.xyz.com:80>
    ServerName www.xyz.com
...
0
 
LVL 15

Assisted Solution

by:samri
samri earned 100 total points
ID: 11859570
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11859673
oops, we either need *:80 for NameVirtualHost, or <VirtualHost www.xyz.com>
0
Technology Partners: 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!

 
LVL 15

Expert Comment

by:samri
ID: 11859712
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
 
LVL 3

Author Comment

by:rfr1tz
ID: 11862477
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
 
LVL 51

Expert Comment

by:ahoffmann
ID: 11862962
see my comment about correction ;-)

NameVirtualHost *
<VirtualHost www.xyz.com>
      ServerName www.xyz.com     
0
 
LVL 15

Expert Comment

by:samri
ID: 11863844

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
 
LVL 3

Author Comment

by:rfr1tz
ID: 11874502
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
 
LVL 3

Author Comment

by:rfr1tz
ID: 11877279
Hi,

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

Thanks,

Rfr1tz
0
 
LVL 15

Expert Comment

by:samri
ID: 11880044
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
 
LVL 3

Author Comment

by:rfr1tz
ID: 11897221
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question