Alan's picture

We've been running our own internal web server for more and a decade and switched to TurnKey Linux several years ago. TKL LAMP 12 was the last version we got working. Due to its age, we attempted to rebuild a new server with LAMP 14.0 and have been fighting with this ever since, even retrying with the updated 14.1 that has since come out and it still does not work as expected.

The premise of what we want to do:

- The server hosts a single domain.
- Users should be able to enter the domain name without knowing it's https.
- The final site should force everything through https.
- We customize the .htaccess file to be ~ht.access (not my idea, I just support it)
- The website is serverd from /home/webadmin/sitename.
- CGI-BIN stays in the usual /var/www/cgi-bin

Using the traditional methods, no form of htaccess works (we tried .htaccess before editing anything as well as ~ht.access and editing like usual). I've tried setting AllowOverride All individually and even simultaneously everywhere possible and it doesn't work.

By default, the system gets irritable when trying to host from /home/webadmin/sitename.

First we "mkdir -p sitename"
Then chmod +o and chmod +x

Finally it serves https but not http

We tried using the GUI to add virtual hosts for 80 and 443 as well as reverting to the default system and editing apache2.conf to simply point the defaults to the /home/webadmin/sitename to have the same problem of hosting https but not http.

When we customize the htaccess file we get:
http shows Forbidden.
https shows Internal Server Error.

When not customizing the htaccess file:

http shows server not found.
https hosts the site but ignores that htaccess even exists.

The current 000-default.conf is as follows:

ServerName test1

<VirtualHost *:80>
       ServerAdmin webmaster@sitename.com
       DocumentRoot /home/webadmin/sitename
</VirtualHost>

<VirtualHost *:443>

       SSLEngine on
       ServerAdmin webmaster@sitename.com
       DocumentRoot /home/webadmin/sitename
</VirtualHost>

ScriptAlias /cgi-bin/ /var/www/cgi-bin/

<Directory /home/webadmin/sitename/>
       Options Indexes FollowSymLinks MultiViews
Require all granted
AllowOverride All
</Directory>

I tried setting the server name to the full domain name and that didn't help.
I tried AllowOverride All in other places as well.


From a default install, what should I be doing to accomplish the original directives of custom home folder location and custom htaccess file name? All of this used to be relatively painless in TurnKey LAMP 12 and older.

Forum: 
Jeremy Davis's picture

We use the Apache package from the Debian repos (which is set up a little different to default Apache but is essentially the same, just the config is laid out a little differently). However what may be tripping you up is that Apache have tightened down the security screws a fair bit in recent times. So your previous config will not work.

The majority of the changes happened between Apache 2.2 (in TurnKey 13.0/Debian Wheezy) and Apache 2.4 (in TurnKey 14.0/Debian Jessie). I suggest that you at least read the Apache docs on that transition.

Having said that the "AllowOverride All" directive should be working as expected (to allow the .htaccess files to override the site config). The only reason it wouldn't be working that I can think of is that you've forgotten to restart Apache ("service apache2 restart") after tweaking config, or an issue with permissions on your .htaccess file (make sure it's readable by www-data).

As for differently named .htaccess files, I have no idea about that. You'll need to check the Apache 2.4 docs to see how that's done now (and even if it's supported).

Riaan's picture

I've recently downloaded turnkey-lamp-14.1 and after having some issues getting rewrites to work, even after setting "AllowOverride All" wherever needed. It turned out that the Apache Rewrite module is not on as a default, I enabled with "a2enmod rewrite" and after restarting Apache all worked as expected

Add new comment