mirror of
https://github.com/michaelstaake/mainty.git
synced 2026-04-16 11:30:13 +00:00
Fixed htaccess issue when using Docker
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -16,14 +16,27 @@ WORKDIR /var/www/html
|
||||
# Copy application files
|
||||
COPY . /var/www/html/
|
||||
|
||||
# Rename example.htaccess to .htaccess if it exists
|
||||
RUN if [ -f /var/www/html/example.htaccess ]; then \
|
||||
mv /var/www/html/example.htaccess /var/www/html/.htaccess; \
|
||||
fi
|
||||
|
||||
# Update .htaccess for root installation (no subfolder)
|
||||
RUN if [ -f /var/www/html/.htaccess ]; then \
|
||||
sed -i '/RewriteBase/d' /var/www/html/.htaccess; \
|
||||
fi
|
||||
|
||||
# Create data directory and set permissions
|
||||
RUN mkdir -p /var/www/html/data && \
|
||||
chown -R www-data:www-data /var/www/html/data && \
|
||||
chmod -R 755 /var/www/html/data
|
||||
chown -R www-data:www-data /var/www/html && \
|
||||
chmod -R 755 /var/www/html
|
||||
|
||||
# Configure Apache to allow .htaccess
|
||||
RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
||||
|
||||
# Set ServerName to suppress warnings
|
||||
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
|
||||
Reference in New Issue
Block a user