Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 01-23-2008, 09:28 PM   #1
LQ Newbie
Registered: Nov 2006
Posts: 14

Rep: Reputation: 0
Apache giving 400 Error !!

Hey Fellas,

I am getting error 400 while accessing my website from its ip address. If I am using its fqdn name then it opens, otherwise giving me 400 error.

Can anyone help me out ??
Old 01-23-2008, 10:38 PM   #2
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,138

Rep: Reputation: 166Reputation: 166
A 400 error is a syntax error in the request. If you're not using the FQDN, what are you using to access the server when the error occurs?

Can you also post your httpd.conf file as well as any relevant info from the access and error logs?
Old 01-24-2008, 08:47 AM   #3
Registered: Dec 2005
Distribution: RedHat, Ubuntu
Posts: 101

Rep: Reputation: 15
that's just how it works...

Originally Posted by spice_prash View Post
I am getting error 400 while accessing my website from its ip address. If I am using its fqdn name then it opens, otherwise giving me 400 error.
If you're configured to use name-based virtual hosting, what you are seeing is the server choosing the wrong (in your opinion) document root.

Apache is listening on one IP address. Your web browser connects (and this is how HTTP/1.1 works -- so this is most every web access for every web server everywhere) and specifies the 'hostname' as one of the headers. This is how apache can figure out which of N web site configs to use to service requests arriving one IP.

So when you go to http://a.b.c.d your browser puts a.b.c.d in the hostname header. And apache is not using the vhost configuration you want it to. It's hairy to get it just right... If you only have *one* web configuration (just one web site) then just pull your document root config command out of the virtual host container. done.

If you have multiple web sites; you cannot fix the problem. What we do is make a tiny little web site with white nothingness and put that document root in the main config. Then we go on to virtualhost config all the web sites that are name based vhosting on the box. HTTP/1.1 request that specify a hostname get served from the right doc root. HTTP/1.1 requests with just the IP in the hostname header get the dummy/blank docroot's content. c'est la vie.

Old 01-25-2008, 12:00 AM   #4
LQ Newbie
Registered: Nov 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Thankx man ...

That really helps...


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
Apache giving the error :Could not determine the server's fully qualified domain name bcf2 Linux - Server 47 02-13-2015 10:34 PM
I'm getting an error 400 (Bad Request) jim.thornton Linux - Server 1 01-19-2008 11:42 PM
Apache, IP based VirtualHosts and 400 error ipslave Linux - Server 2 06-06-2007 06:28 AM
why is apache giving me a 404 error linuxmandrake Linux - Software 4 06-17-2005 09:16 AM
Apache 1.3.20 close connection on HTTP 1.1 400 500 errors dafri Linux - Software 4 01-14-2003 08:50 AM > Forums > Linux Forums > Linux - Server

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

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