0

I have a working server setup with Apache running with Phusion Passenger. Because the friendly error page turned off by default (good for production apps), it's hard to spot the error when it's happen.

I want to enable PassengerFriendlyErrorPages specific for some sites, using .htaccess:

PassengerFriendlyErrorPages on

But then Apache results in 500 error (Edit: still same error):

/home/area51/public_html/public/.htaccess: PassengerFriendlyErrorPages not allowed here

Is there something I miss? (note the documentation says the context can be in .htaccess so it made me confused)

PS: httpd.conf works, though it's not my option here.

EDIT: My apache config, as I don't know why it still not working. (Yes I'm aware about systemctl restart httpd)

I put the .htaccess in /home/area51/public_html/public

<VirtualHost 10.0.1.6:80>
SuexecUserGroup "#1083" "#1083"
ServerName area51.dom.my.id
ServerAlias www.area51.dom.my.id
DocumentRoot /home/area51/public_html/public
ErrorLog /var/log/virtualmin/area51.dom.my.id_error_log
CustomLog /var/log/virtualmin/area51.dom.my.id_access_log combined
DirectoryIndex index.html index.php
<Directory /home/area51/public_html/public>
RewriteEngine On
allow from all
AllowOverride All
Require all granted
</Directory>
RemoveHandler .php
RemoveHandler .php7.2
<FilesMatch \.php$>
SetHandler proxy:fcgi://localhost:8014
</FilesMatch>
</VirtualHost>
willnode
  • 126
  • 4
  • I just noticed that you seem to be using Virtualmin. That is probably part or all of the problem here, and anyway, we consider such systems [unsupportable](https://meta.serverfault.com/q/8094/126632) here. – Michael Hampton Jul 15 '20 at 04:01
  • It's weird that such system can introduce this problem (like, this should be specific for apache). But I understand anyway. Thanks, I will move to their forums instead in the future. – willnode Jul 15 '20 at 08:31

1 Answers1

1

The <Directory> containing the .htaccess file must itself allow this, with AllowOverride Options.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • Is `AllowOverride All` (without Options) enough? I've been trying different configurations and restarting httpd couple of times with no luck. – willnode Jul 15 '20 at 01:24
  • Yes, `All` should also be sufficient. – Michael Hampton Jul 15 '20 at 01:43
  • I did it. Unfornatunely it still doesn't work. Must be something else. I have edited my question to add the httpd.conf part that relevant. – willnode Jul 15 '20 at 02:19
  • @willnode You don't have a `` that matches the directory your `.htaccess` is in. Check the path carefully. – Michael Hampton Jul 15 '20 at 02:22
  • Sorry, I did move the .htacess to `/home/area51/public_html/public/.htaccess`. Still not working. The app is in `/home/area51/public_html/app.js` if that's relevant. – willnode Jul 15 '20 at 02:26
  • @willnode You also need to remove the old Apache 2.2 directive `allow from all`. – Michael Hampton Jul 15 '20 at 02:42
  • I did it. Still the same. Now here's some interesting pattern, i put `Options +Indexes` before the passenger line in .htaccess, just for checking. turns out that options indexes passes (still err to passenger). Then I remove `AllowOverride All` in httpd.conf, now that options is not allowed. even though I set the default directory allowoverride to all. – willnode Jul 15 '20 at 03:29
  • So this all just made me more confused. If AllowOverride All didn't work, then it must be my server setup that goes wrong. I don't know, I might just stick to put them to httpd.conf right now. Thanks for your help anyway. – willnode Jul 15 '20 at 03:32