Apache docker container - Invalid command 'RewriteEngine'

后端 未结 2 650
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-28 18:58

I use docker compose. However, when I run \"docker-compose up\", I came across an error : /var/www/html/.htaccess: Invalid command \'RewriteEngine\'.

Can you tell me

2条回答
  •  天涯浪人
    2020-12-28 19:42

    This works for me:

    # Dockerfile
    FROM php:5.6-apache
    
    MAINTAINER Raphael Mäder 
    
    RUN a2enmod rewrite
    
    ADD . /var/www/html
    

    Don't forget to run your docker-compose up command with --build if you have already built the image previously, otherwise it will run the old image which may have not included the RUN a2enmod rewrite statement.

提交回复
热议问题