Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache2 configuration problem
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Wed Nov 02, 2005 11:17 pm    Post subject: Apache2 configuration problem Reply with quote

If I don't have an index file in a directory it displays the files. Searched some and found out that you should remove the 'Indexes' part from

Code:
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>


But it was never there... :oops:

I have a .htaccess file in a directory that doesn't work as it did before. Now it doesn't show folders first.
Code:
Options +indexes
IndexOptions FancyIndexing FoldersFirst


Since I havent changed anything with that file I guess it's something that overrides the .htaccess file in the config.

Thanks, Stefan.
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Thu Nov 03, 2005 12:10 am    Post subject: Re: Apache2 configuration problem Reply with quote

zeuz wrote:
If I don't have an index file in a directory it displays the files. Searched some and found out that you should remove the 'Indexes' part from

Code:
<Directory />
    Options Indexes FollowSymLinks
    AllowOverride None
</Directory>


But it was never there... :oops:

I have a .htaccess file in a directory that doesn't work as it did before. Now it doesn't show folders first.
Code:
Options +indexes
IndexOptions FancyIndexing FoldersFirst


Since I havent changed anything with that file I guess it's something that overrides the .htaccess file in the config.

Thanks, Stefan.


Hi.

This post should have been made in the Networking & Security forum.
The following directive in your directory, prevents the .htaccess files from overriding your options.
Code:
    AllowOverride None

_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Thu Nov 03, 2005 7:44 am    Post subject: Reply with quote

Moved from Installing Gentoo to Networking & Security.
_________________
KDE
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Thu Nov 03, 2005 8:28 am    Post subject: Reply with quote

Sorry for the misplacing.

Changed AllowOverride None to AllowOverride All, didn't help. :(
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Thu Nov 03, 2005 10:44 am    Post subject: Reply with quote

zeuz wrote:
Sorry for the misplacing.

Changed AllowOverride None to AllowOverride All, didn't help. :(


Don't go from one extreme to the other, you may latter be sorry for that. :wink: I think you just need to use AllowOverride Indexes.
Did you check the .htaccess file permissions? I don't know if Apache will accept to read files with too permissive file modes.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Tue Nov 08, 2005 9:24 pm    Post subject: Reply with quote

Ohh... :oops: I've thought of file permissions, but since it displays the files it couldn't be that.
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Wed Nov 09, 2005 2:02 am    Post subject: Reply with quote

Do you mean that Apache shows you the contents of the .htacess file? If so, it shouldn't.
You should have the following snipet in httpd.conf.
Code:
<Files ~ "^\.ht">
  Order allow,deny
  Deny from all
</Files>

_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Tue Nov 15, 2005 8:30 pm    Post subject: Reply with quote

No, the .htacess is hidden, but it doesn't order folders first. And directorys without an index-file exposes it's contents. That's what i'm having problems with.
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Wed Nov 16, 2005 1:44 pm    Post subject: Reply with quote

Does anyone have an idea on what could be wrong?
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Thu Nov 17, 2005 10:18 am    Post subject: Reply with quote

zeuz wrote:
No, the .htacess is hidden, but it doesn't order folders first. And directorys without an index-file exposes it's contents. That's what i'm having problems with.


zeuz,

I'm sorry, but I can't understand what you are trying to do!
Do you want apache to list the files if you don't have an index file? If so, are you complaining about the order apache displays the files and folders? What were you expecting?
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Thu Nov 17, 2005 1:52 pm    Post subject: Reply with quote

If the directory don't have an index file I want apache to display the error message for that. And my files/ dir with the htaccess file should order folders first, but it doesn't. (it did before reinstalling the server)
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Sat Nov 19, 2005 12:18 am    Post subject: Reply with quote

OK! Now I understand what you want to do.
Please post the config of your directory entries in apache and the contents of your .htaccess files.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Sat Nov 19, 2005 12:55 am    Post subject: Reply with quote

After looking at the apache documentation, are you using the following in your .htaccess files?
Code:
<Directory ...>
   IndexOptions FoldersFirst
</Directory>

_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sat Nov 19, 2005 9:54 am    Post subject: Reply with quote

Code:
Options +indexes
IndexOptions FancyIndexing FoldersFirst


That's how the .htaccess looks like. I haven't changed anything in it since i reinstalled the server.

I managed to get folders first by adding "IndexOptions FancyIndexing FoldersFirst" at the <Directory /> part in the config but the problem is that when there isn't a index file in a dir, it displays the files. I want it to display an error message.
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Sat Nov 19, 2005 11:53 pm    Post subject: Reply with quote

I've understood what you want, but you didn't include the directory entries configuration.
If you look at your http.conf file, you should find that the autoindex_module is being loaded. If you comment it out and restart apache, it should stop creating an automatic index for directories without index.* files. You should then create a redirect page for the 404 error.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sun Nov 20, 2005 8:57 am    Post subject: Reply with quote

I'm not sure if this is what you want to see..

Code:
<Directory />
    Options FollowSymLinks -Indexes
    AllowOverride Indexes
</Directory>


I added the -Indexes and it works, except that it says "not found" instead of forbidden. If i remove the autoindex_module I wont be able to have my files/ directory?
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Sun Nov 20, 2005 10:25 pm    Post subject: Reply with quote

I thought that the problem might lay in the directory entries. Afterwards, I found out that it seems to be related to module_autoindex.
I've tried to solve your issue on my apache server and found out that after preventing apache from loading the module, I was still able to access the files inside the dirs, but that I would get a 404 error if I didn't had an index.* file and tried to open the dir. Isn't this what you want? You would just have to include a redir page for the 404 error.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Tue Nov 22, 2005 6:37 am    Post subject: Reply with quote

The 404 error is ok, it does what i want - hide directories that doesn't have index files. The only problem now is that i can't get the .htaccess to work with my files/ dir.
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Tue Nov 22, 2005 5:52 pm    Post subject: Reply with quote

Have you changed the root entry in /etc/apache2/httpd.conf to allow the override?
After looking at your previous posting, I would try to use the following:
Code:
<Directory />
    Options FollowSymLinks
    AllowOverride Indexes
</Directory>

_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Tue Nov 22, 2005 9:41 pm    Post subject: Reply with quote

Nothing changed, i'm still getting the 404 message when trying to access files/... :oops:
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Tue Nov 22, 2005 11:18 pm    Post subject: Reply with quote

Well, I'm able to access files on my server, to open a dir with an index file (index.php) and get a 404 error if trying to open a dir without an index file.
My /etc/apache2/httpd.conf is as follows:
Code:
...
<IfDefine INFO>
    LoadModule info_module               modules/mod_info.so
    LoadModule status_module             modules/mod_status.so
</IfDefine>
LoadModule actions_module                modules/mod_actions.so
#LoadModule autoindex_module              modules/mod_autoindex.so
LoadModule dir_module                    modules/mod_dir.so
...
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
...
DirectoryIndex index.html index.html.var
...
AccessFileName .htaccess
...
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

If you try to open http://jmbsvicetto.homelinux.org/gentoo/ you'll get a 404 error, because I don't have an index file. Howerver, you can open http://jmbsvicetto.homelinux.org/gentoo/kernel-config-amd64 and https://jmbsvicetto.homelinux.org/horde/ - although I'm having a problem with SSL connections from the exterior.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh


Last edited by jmbsvicetto on Sat Nov 26, 2005 2:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sat Nov 26, 2005 10:09 am    Post subject: Reply with quote

I've checked the config and it matches what you wrote above. The .htaccess file still won't work. :(
Back to top
View user's profile Send private message
jmbsvicetto
Moderator
Moderator


Joined: 27 Apr 2005
Posts: 4735
Location: Angra do Heroísmo (PT)

PostPosted: Sat Nov 26, 2005 2:16 pm    Post subject: Reply with quote

In that case I'm getting out of ideas. As a final test, what version of apache do you have? I have 2.0.54-r31.
_________________
Jorge.

Your twisted, but hopefully friendly daemon.
AMD64 / x86 / Sparc Gentoo
Help answer || emwrap.sh
Back to top
View user's profile Send private message
zeuz
Tux's lil' helper
Tux's lil' helper


Joined: 26 May 2004
Posts: 140
Location: Sweden

PostPosted: Sat Nov 26, 2005 3:38 pm    Post subject: Reply with quote

Server version: Apache/2.0.54
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum