1

For a few hours now, I've been trying to create a working .htaccess file that forbids access to all files with the exception of a few files and folders.

But whenever I write Allow from all in my .htaccess file in a direct subdirectory of my root folder /srv/www/htdocs/, it just says "Server error!" the end. In the attachment I send you my current httpd.conf and `default-server.conf.

My system:

OS: openSUSE Tumbleweed x86_64 
Host: 20XXS00100 ThinkPad X1 Carbon Gen 9 
Kernel: 5.13.13-1-default 
Uptime: 12 hours, 14 mins 
Packages: 5771 (rpm), 8 (snap) 
Shell: bash 5.1.8 
Resolution: 1920x1200 
DE: Plasma 5.22.4 
WM: KWin 
Theme: Breeze Dark [Plasma], Breeze [GTK2/3] 
Icons: [Plasma], breeze-dark [GTK2/3] 
Terminal: konsole 
CPU: 11th Gen Intel i7-1165G7 (8) @ 4.700GHz 
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] 
Memory: 5945MiB / 31820MiB

If you can help me with this, I would be very grateful!

default-server.conf: https://www.opensuse-forum.de/wcf/attachment/15371-default-server-conf-txt/

httpd.conf: https://www.opensuse-forum.de/wcf/attachment/15372-httpd-conf-txt/

levi-jcbs
  • 23
  • 3
  • 1
    What does the log show? Whenever you see a server error message, check your logs. – vidarlo Sep 02 '21 at 13:46
  • 2
    That config (`Allow from All`) is legacy and can only be used if "mod_access_compat" is loaded. Either convert the expression to new format `Require ...` or load the referred module. – João Alves Sep 02 '21 at 13:56
  • How were you _blocking_ access in the parent(?) `.htaccess` file? (I would have assumed you'd get a similar response/error?) – MrWhite Sep 02 '21 at 16:16
  • @MrWhite No, there is no error in the parent directory. – levi-jcbs Sep 03 '21 at 09:56
  • Do you mind showing the contents of your root (parent) `.htaccess` file? As it stands, the most probable cause (and resolution) is as stated by João Alves above. Just to add, you should not mix old and new auth/access directives. On Apache 2.4 you should be using the new `Require` directives, but you must convert _all_ instances to the new version. The server config you posted encloses all the auth directives in conditionals so both "work" without error. – MrWhite Sep 03 '21 at 10:19

1 Answers1

1

I have to use the "Require" directive, then it works.

Thanks to @MrWhite

levi-jcbs
  • 23
  • 3