Solved

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

Posted on 2004-08-20
11
753 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
  • 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
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now