Php: How to configure the open apache .htaccess

Created on 21 Dec 2016  路  10Comments  路  Source: docker-library/php

How to configure the open apache .htaccess

Most helpful comment

I assume you use php:apache variant. In your dockerfile, Just add :

a2enmod rewrite

So that htaccess is read.

All 10 comments

Can you please be a little more specific about what you've tried to do and what's not working for you?

I assume you use php:apache variant. In your dockerfile, Just add :

a2enmod rewrite

So that htaccess is read.

Thank you for the success.

@nsteinmetz I am sorry, I am a beginner.
where should I add this line?

@MetaiR

You would have something like below in your Dockerfile :

FROM php:apache
RUN a2enmod rewrite

Question: can you use a2enmod rewrite without a dockerfile? I.e. when using the Docker UI in Synology, the possibilities are rather constrained, but I'd like to have it working without leaving the UI.

@doodhout: When you can use docker-compose you can specify a build-step with Dockerfile.
You can also build your own image + push it onto Dockerhub or similar, so the Synology Docker can pull it.

I'd rather not mess around but just use prebuilt images from upstream.

The trick I used to have this working without having to edit the docker file and build the image myself, is to SSH into the (running) container and enable a2enmod from there. Works fine.

If you insist to not have your own dockerfile you can change the run command to something like
sh -c "a2enmod rewrite && exec apache2-foreground"
if that is possible inside the Synology UI

That's very much possible, since we have shell access to each running container from the web UI.

Was this page helpful?
0 / 5 - 0 ratings