Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
.htaccess and https problem [solved]
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
snIP3r
l33t
l33t


Joined: 21 May 2004
Posts: 853
Location: germany

PostPosted: Sun Jan 14, 2007 10:33 am    Post subject: .htaccess and https problem [solved] Reply with quote

hi all!

im trying to secure a directory via .htaccess and also want to use https. so i added a .htaccess file to the directory with this content:

Code:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*)  https://%{SERVER_NAME}%{REQUEST_URI}

AuthType Basic
AuthName "myAuth"
AuthUserFile /path/to/htpasswd.users
require valid-user


but this config does not work. i get an error in /var/log/apache2/ssl_error_log:
Code:

[error] [client 192.168.0.23] Directory index forbidden by rule: /path/to/be/protected


i wonder about this. because i have AllowOverride All in my /etc/apache2/vhosts.d/00_default_vhost.conf file enabled. which rule forbids the connection??

does anyone know whats the problem and how to fix it??

thx for help in advance

snIP3r
_________________
Intel i3-4130T on ASUS P9D-X
Kernel 5.15.88-gentoo SMP
-----------------------------------------------
if your problem is fixed please add something like [solved] to the topic!


Last edited by snIP3r on Sun Jan 14, 2007 3:31 pm; edited 1 time in total
Back to top
View user's profile Send private message
snIP3r
l33t
l33t


Joined: 21 May 2004
Posts: 853
Location: germany

PostPosted: Sun Jan 14, 2007 3:30 pm    Post subject: Reply with quote

hi all!

after some excessive google search i fixed the problem:
i had to enable my /etc/apache2/modules.d/41_mod_ssl.default-vhost.conf config. now it runs perfect. i also added some "directory" passage to override settings. looks like this:

Code:

<IfDefine SSL>

  # We now wrap the entire default vhost in a seperate IfDefine to fix bug
  # 100624. If you are using this default vhost, add it to /etc/conf.d/apache2
  <IfDefine SSL_DEFAULT_VHOST>

<IfModule mod_ssl.c>
##
## SSL Virtual Host Context
##

<VirtualHost *:443>
#   General setup for the virtual host
DocumentRoot "/var/www/localhost/htdocs"
ServerName localhost:443
<Directory "/var/www/localhost/htdocs">
     Options Indexes FollowSymLinks
     AllowOverride All
     Order deny,allow
     Allow from all
</Directory>
ServerAdmin root@localhost
ErrorLog logs/ssl_error_log
...


and also enable the config on apache2 start:

Code:

/etc/conf.d/apache2

...
APACHE2_OPTS="-D SSL -D PHP4 -D DEFAULT_VHOST -D SSL_DEFAULT_VHOST -D USERDIR -D PROXY"
...



hope this helps someone with the same problem like mine;)


greets2all
snIP3r
_________________
Intel i3-4130T on ASUS P9D-X
Kernel 5.15.88-gentoo SMP
-----------------------------------------------
if your problem is fixed please add something like [solved] to the topic!
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