MAPG-92 use Nginx instead of Apache in Docker environment

This commit is contained in:
Bence Pőcze 2020-05-31 14:41:53 +02:00
parent 0ca7ea75b2
commit 6115dc7bc6
3 changed files with 29 additions and 23 deletions

View File

@ -2,16 +2,14 @@ FROM ubuntu:focal
ENV DEBIAN_FRONTEND noninteractive
# Install Apache, PHP and further necessary packages
RUN apt update
RUN apt install -y curl git mariadb-client apache2 \
# Install Nginx, PHP and further necessary packages
RUN apt update --fix-missing
RUN apt install -y curl git mariadb-client nginx \
php-apcu php-xdebug php7.4-cli php7.4-curl php7.4-fpm php7.4-mbstring php7.4-mysql php7.4-zip
# Configure Apache with PHP
# Configure Nginx with PHP
RUN mkdir -p /run/php
RUN a2enmod proxy_fcgi rewrite
RUN a2enconf php7.4-fpm
COPY configs/apache.conf /etc/apache2/sites-available/000-default.conf
COPY configs/nginx.conf /etc/nginx/sites-available/default
RUN echo "xdebug.remote_enable = 1" >> /etc/php/7.4/mods-available/xdebug.ini
RUN echo "xdebug.remote_autostart = 1" >> /etc/php/7.4/mods-available/xdebug.ini
RUN echo "xdebug.remote_connect_back = 1" >> /etc/php/7.4/mods-available/xdebug.ini
@ -29,4 +27,4 @@ EXPOSE 80
VOLUME /var/www/mapguesser
WORKDIR /var/www/mapguesser
ENTRYPOINT /usr/sbin/php-fpm7.4 -F & /usr/sbin/apache2ctl -DFOREGROUND
ENTRYPOINT /usr/sbin/php-fpm7.4 -F & /usr/sbin/nginx -g 'daemon off;'

View File

@ -1,15 +0,0 @@
<VirtualHost *:80>
ServerName mapguesser-dev.ch
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mapguesser/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory /var/www/mapguesser/public>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

23
docker/configs/nginx.conf Normal file
View File

@ -0,0 +1,23 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/mapguesser/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name mapguesser-dev.ch;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}