docker-lamp icon indicating copy to clipboard operation
docker-lamp copied to clipboard

000-default.conf + htaccess, rewrite

Open boxxroom opened this issue 3 years ago • 6 comments

Not sure if this to be an issue or just a configuration, however, in order for the server to honour the .htaccess file within the /app (or server root) directory I had to edit the 000-default.conf file found in /etc/apache2/sites-available/000-default.conf specifically the <Directory ... tag for the DocumentRoot. Just to add this is when using an OctoberCMS installation.

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html
        <Directory /var/www/>
        ...

boxxroom avatar Sep 21 '21 13:09 boxxroom

I don't know why but your suggestion did solve the problem.

pimvanderheijden avatar Sep 24 '21 13:09 pimvanderheijden

:+1: I've had the same Issue, your tip solved it !

(tag latest-1804)

The .htaccess file was not processed at all without this manual edit.
This debug process helped, also : https://stackoverflow.com/a/9234323

jimetevenard avatar Nov 02 '21 23:11 jimetevenard

Yes, it happens to me too

When migrating to another machine my .htaccess suddenly stop working. I add /var/www at Directory tag as suggested and voila ... my web running again

esarijal avatar Dec 05 '21 00:12 esarijal

Thanks for the tip ... hit this, too, and the Directory change did the trick. I'm using the mattrayner/lamp:latest-1804-php7 Docker image.

erichmusick avatar Dec 31 '21 00:12 erichmusick

For anyone else looking, you can probably do this neatly on startup with your Dockerfile:

FROM mattrayner/lamp:latest-1804-php7

CMD ["/run.sh"]

# See https://github.com/mattrayner/docker-lamp/issues/124
RUN ["sed", "-i", "s/<Directory \\/>/<Directory \\/var\\/www\\/>/g", "/etc/apache2/sites-available/000-default.conf"]
RUN ["apachectl", "graceful"]

giles-v avatar Jan 31 '22 15:01 giles-v

Yes <Directory /> caused problems at my setup too

dev-clavis avatar Dec 03 '22 10:12 dev-clavis