LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache giving 400 Error !! (https://www.linuxquestions.org/questions/linux-server-73/apache-giving-400-error-615871/)

spice_prash 01-23-2008 09:28 PM

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 ??

gilead 01-23-2008 10:38 PM

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?

cconstantine 01-24-2008 08:47 AM

that's just how it works...
 
Quote:

Originally Posted by spice_prash (Post 3033283)
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.

-c

spice_prash 01-25-2008 12:00 AM

Thankx man ...

That really helps...


All times are GMT -5. The time now is 07:27 PM.