LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 02-24-2009, 07:36 AM   #1
nikhil010586
Member
 
Registered: Oct 2007
Posts: 44

Rep: Reputation: 15
Cannot Access Apache Web URLs Remotely Without Port Number


Hi,

I have hosted a few pages on my Apache Web Server. The pages are accessible locally by simply hitting on the URL http://localhost/pageName.html with all the page resources(images and CSS) intact. However, when I try to access the same page remotely from some other machine, Apache throws a Bad Request Error message. Also, the page body is visible if I append the port number to the same URL viz. http://192.168.0.33:80/pageName.html . But in that case, the page resources are not visible.
I set up a sniffer to see where exactly is the browser getting at, and found that Apache won't cater the request unless you explicitly specify the port number.
Of all this, I understand that http requests are not being forwarded automatically to port 80 on my host machine. Is there a way to solve this problem so that I can access my Web server remotely?
 
Old 02-24-2009, 08:22 AM   #2
chitambira
Member
 
Registered: Oct 2008
Location: Fife
Distribution: RHEL, Centos
Posts: 373
Blog Entries: 1

Rep: Reputation: 49
have to configure the default port in your apache config. where is your apache listening on?
 
Old 02-25-2009, 01:22 AM   #3
nikhil010586
Member
 
Registered: Oct 2007
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chitambira View Post
have to configure the default port in your apache config. where is your apache listening on?
Its listening on the default port 80. The Listen attribute in /etc/httpd/httpd.conf is set to 80.
 
Old 02-25-2009, 02:28 AM   #4
maas187
Member
 
Registered: Aug 2008
Location: Yemen
Distribution: Fedora, CentOS, RedHat , OpenFiler, ESXI
Posts: 210

Rep: Reputation: 32
Question

Quote:
Originally Posted by nikhil010586 View Post
Hi,

I have hosted a few pages on my Apache Web Server. The pages are accessible locally by simply hitting on the URL http://localhost/pageName.html with all the page resources(images and CSS) intact. However, when I try to access the same page remotely from some other machine, Apache throws a Bad Request Error message. Also, the page body is visible if I append the port number to the same URL viz. http://192.168.0.33:80/pageName.html . But in that case, the page resources are not visible.
I set up a sniffer to see where exactly is the browser getting at, and found that Apache won't cater the request unless you explicitly specify the port number.
Of all this, I understand that http requests are not being forwarded automatically to port 80 on my host machine. Is there a way to solve this problem so that I can access my Web server remotely?

show me the result of those commands.

1 - netstat -at and netstat -ant
2 - iptables -L -n

1st 2 commands would give me a better idea on what port apache is running on
and the 2nd to see if your firewall is not blocking apache.
 
Old 02-25-2009, 12:25 PM   #5
pcunix
Member
 
Registered: Dec 2004
Location: MA
Distribution: Various
Posts: 149

Rep: Reputation: 23
Naw, there's something more strange afoot here.

Port 80 isn't blocked or he couldn't get to it by specifying the port directly.

I don't think the server is at fault here. I think it's the CLIENT that is not defaulting to port 80 when it should.

Does the sniffer show that?
 
Old 02-25-2009, 05:25 PM   #6
kuhazor
Member
 
Registered: Jul 2005
Posts: 36

Rep: Reputation: 15
Make sure your name based virtual domains setting is not on. If it is then you must create virtual server entry for the host domain as well as any virtual domains.
 
Old 03-07-2009, 04:05 AM   #7
nikhil010586
Member
 
Registered: Oct 2007
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by kuhazor View Post
Make sure your name based virtual domains setting is not on. If it is then you must create virtual server entry for the host domain as well as any virtual domains.
How do I check that?
 
Old 03-07-2009, 04:10 AM   #8
nikhil010586
Member
 
Registered: Oct 2007
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pcunix View Post
Naw, there's something more strange afoot here.

Port 80 isn't blocked or he couldn't get to it by specifying the port directly.

I don't think the server is at fault here. I think it's the CLIENT that is not defaulting to port 80 when it should.

Does the sniffer show that?
The sniffer did not show port 80 appended to the URL unless explicitly specified. I'm not able to figure out the reason for such a strange behaviour where the requests cannot be handled directly by my Apache Web server. A direct hit on http://local-ip gives an Apache error message for Bad request. This means my http requests are being redirected to Apache web server.
 
Old 03-07-2009, 05:27 AM   #9
nikhil010586
Member
 
Registered: Oct 2007
Posts: 44

Original Poster
Rep: Reputation: 15
Finally found a solution for my own problem. And that too in some modsecurity configuration files. The culprit here was a file named modsecurity_crs_21_protocol_anomalies.conf in /etc/httpd/ directory. Checked through the logs just to find an error marked as SEVERE which had a message "Host header is a numeric IP address".

To get rid of it, I commented out the line which filtered out requests coming for specific IP address, 127.0.0.1 included. I'd like to mention here that my apache web server showed up on the same machine on hitting http://localhost but not after hitting on http://127.0.0.1 . The line that I commented out was as follows:

# Check that the host header is not an IP address
#
SecRule REQUEST_HEADERS:Host "^[\d\.]+$" "phase:2,t:none,deny,log,auditlog,status:400,msg:'Host header is a numeric IP address', severity:'2',id:'960017',tag:'PROTOCOL_VIOLATION/IP_HOST'"

Thanks for all those who actively participated in the discussion!
Nikhil.
 
  


Reply

Tags
apache, port


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't access Apache remotely zwyrbla Linux - Software 7 03-23-2005 08:14 PM
Allow this particular web page access on port 443 ONLY lothario Linux - Software 2 01-14-2005 11:14 PM
stealth port 80 while running apache web server? TheOneAndOnlySM Linux - General 3 04-24-2004 09:52 AM
seeking for web sites port number !!! hitesh_linux Linux - General 6 04-15-2003 11:21 AM
How to access a web site with port number from mozilla 1.0? gogo Linux - Software 3 09-03-2002 07:24 PM


All times are GMT -5. The time now is 12:10 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration