LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-22-2005, 09:29 AM   #1
dissectional
LQ Newbie
 
Registered: Apr 2004
Posts: 8

Rep: Reputation: 0
Trailing "/" required for URLs on Apache Server?


Hi,

I've recently installed Apache 1.3.33 on a Debian machine and all is working well - with the exception of one thing. I can visit my machine's web page root via http : / / xx.xx.xx.xx and it displays fine. However, when I wish to browse to one of the displayed subdirs, I get a 'connection refused' error.

If I key in the address of the subdir in the URL:

h t t p : / / xx.xx.xx.xx/folder/

( note the trailing slash ) it works fine.

On previous installations I could browse dirs without any problems and I could also specify URLs without the need of a trailing slash ( / ). If I don't put a trailing slash behind URLs, I get the connection refused error. Its quite weird. I was curious if I've overlooked something really obvious here. All the dirs and subdirs I have also chmodded to 777 to see if permissions were to blame. Alas, no difference - suggesting my Apache configuration may be a little off in httpd.conf - which I can post here if required.

Any ideas?
 
Old 04-23-2005, 02:17 AM   #2
uberNUT69
Member
 
Registered: Jan 2005
Location: Tasmania
Distribution: Xen Debian Lenny/Sid
Posts: 578

Rep: Reputation: 30
My guess would be that your root directory is not browsable.
 
Old 04-23-2005, 04:01 AM   #3
dissectional
LQ Newbie
 
Registered: Apr 2004
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by uberNUT69
My guess would be that your root directory is not browsable.
Thanks for the response, Ubernut.

The root dir is viewable, but traversing into subdirs thereafter gives me this error. Is there a setting in httpd.conf that controls browsing the root dir?
 
Old 04-23-2005, 02:57 PM   #4
twsnnva
Member
 
Registered: Oct 2003
Location: Newport News, Va
Distribution: Debian
Posts: 246

Rep: Reputation: 30
The reason that doesn't work is because apache is looking for a file named "folder" in the document root. Apache has a module called mod_rewrite that can fix this, I've never used it, so I don't know the syntax, but I'm sure google does.

To allow directory browsing you need to add "Indexes" to the <Directory /your/doc/root > features.

Code:
<Directory /var/www/localhost >
    Options Indexes Includes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
 
Old 04-23-2005, 06:21 PM   #5
dissectional
LQ Newbie
 
Registered: Apr 2004
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by twsnnva
[B]The reason that doesn't work is because apache is looking for a file named "folder" in the document root. Apache has a module called mod_rewrite that can fix this, I've never used it, so I don't know the syntax, but I'm sure google does.

To allow directory browsing you need to add "Indexes" to the <Directory /your/doc/root > features.
Thanks for the reply. Below is the config for my server's Document root directory:

<Directory "/website">
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

'Indexes' is definately enabled. I understanding a trailing '/' is not supposed to be used when I specify the Documentroot directory - correct?

I'm considering digging up the default Apache httpd.conf file and starting fresh - I assume this will reset me to defaults, and I can make my changes again step by step. On previous machines I've never encountered this behaviour before, and I've rebuilt this box multiple times this week :)
 
Old 04-29-2005, 07:40 AM   #6
dissectional
LQ Newbie
 
Registered: Apr 2004
Posts: 8

Original Poster
Rep: Reputation: 0
Eureka!

I've discovered the problem, if anyone cares, or is perhaps suffering from the same thing :

You need to have the correct 'ServerName' setting in your httpd.conf file reflecting the actual hostname of your Linux machine. i.e.:

ServerName "mylinuxmachine"

I changed this to reflect a server name in my httpd.conf file that didn't exist, which required me to enter trailing '/' characters to validate sub directories. Once changed to the legitimate servername on my hosting linux machine, trailing slahes were no longer required. A pretty dumb oversight on my behalf, but at the same time its weird how things still worked, albeit required the trailing slash.

Thanks for the help regardless though gents!
 
  


Reply



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
problem with "&goto=newpost" terminating URLs Ygrex LQ Suggestions & Feedback 2 11-18-2005 03:56 PM
make "localhost" point to a subdirectory of Apache server oudent Linux - Networking 2 07-21-2005 07:37 PM
KDE's "Run Command" not working for URLs scarr2508 Linux - Newbie 0 10-28-2004 04:58 AM
Apache/Tomcat : jsp = "No Host matches server name" ghow961 Linux - Networking 0 07-01-2004 06:20 PM
I cannot use "java chat". Browser says plugin required "x-java-vm". jdruin Linux - Software 4 04-18-2004 05:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:31 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration