I am using puppet docker (https://forge.puppet.com/modules/puppetlabs/docker)
and setup PHP-Apache website using PHP docker image (https://hub.docker.com/layers/php/library/php/7.2.34-apache/images/sha256-77e5a326252f951aa557f48829973f67e8efde9c52f81ee4e4a5473a59a217d9?context=explore)
The PHP script works fine but when I added .htaccess file in folder, it is throwing error
[Mon Jan 25 09:52:12.078604 2021] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.38 (Debian) PHP/7.2.34 configured -- resuming normal operations
[Mon Jan 25 09:52:12.078766 2021] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
[Mon Jan 25 09:52:32.734378 2021] [autoindex:error] [pid 16] [client 172.17.0.1:50756] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
172.17.0.1 - - [25/Jan/2021:09:52:32 +0000] "GET / HTTP/1.1" 403 493 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
172.17.0.1 - - [25/Jan/2021:09:52:32 +0000] "GET /favicon.ico HTTP/1.1" 404 489 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
[Mon Jan 25 09:56:33.265445 2021] [autoindex:error] [pid 18] [client 172.17.0.1:50830] AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
172.17.0.1 - - [25/Jan/2021:09:56:33 +0000] "GET / HTTP/1.1" 403 493 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
[Mon Jan 25 09:56:52.186711 2021] [core:alert] [pid 17] [client 172.17.0.1:50854] /var/www/html/packageContent/.htaccess: Invalid command 'RewriteRule', perhaps misspelled or defined by a module not included in the server configuration
I believe I need to RUN a2enmod rewrite
as in here (https://stackoverflow.com/a/38064289/376702)
I don't know how can I set up using puppet docker(https://forge.puppet.com/modules/puppetlabs/docker).
Can anyone please guide me? Here is my puppet code.
docker::image { 'docker.io/php':
image_tag => '7.2.34-apache'
}
docker::run { 'test123.com':
image => 'docker.io/php:7.2.34-apache',
command => 'apache2-foreground',
expose => ['80'],
ports => ['8101:80'],
volumes => ['/var/www/test123.com:/var/www/html'],
hostname => 'test123.com',
restart_service => true,
before_stop => 'echo "So Long, and Thanks for All the Fish"',
before_start => 'echo "Run this on the host before starting the Docker container"',
after_stop => 'echo "container has stopped"',
after_start => 'echo "container has started"',
extra_parameters => [ '--restart=always' ],
}
I am running docker in Linux RedHat
Ref:
.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
question from:
https://stackoverflow.com/questions/65883669/puppet-docker-php-apache-setup-invalid-command-rewriterule-perhaps-misspell 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…