From 11a69ed06c71f6854b2a1883bc99116329c8d3ef Mon Sep 17 00:00:00 2001 From: LeonardoBizzoni Date: Mon, 11 Apr 2022 13:03:12 +0200 Subject: [PATCH] Nginx web server --- README.org | 27 +++++++++++++++++++++++---- containers/web/Dockerfile | 15 +++++++++++++++ containers/web/nginx.conf | 26 ++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 containers/web/Dockerfile create mode 100644 containers/web/nginx.conf diff --git a/README.org b/README.org index 5f4991e..fd67884 100644 --- a/README.org +++ b/README.org @@ -52,7 +52,26 @@ Se l'idol in questione non è attualmente live viene mostrata una pagina che not Questa speciale pagina viene automaticamente creata per le idol _non_ indipendenti, per le VTuber indipendenti sarà compito dell'utente creare la loro pagina e fornire il link alla loro pagina YouTube. Una volta creata la pagina chiunque altro sia registrato è in grado di apportare modifiche. -* Codice -** Frontend - JS -** Backend - PHP -** Database - MariaDB +* Realizzazione +** Configurazione ed installazione server +*** Server web - Nginx +Ho deciso di utilizzare Nginx come web server perchè offre performance nettamente migliori ed è più leggero di altri web server. +L'installazione viene effettuata tramite un docker container e la seguente container image: +#+begin_src dockerfile :tangle containers/web/Dockerfile +FROM php:8.1.4-fpm-alpine3.14 +WORKDIR /var/www/html + +RUN apk update && apk add --no-cache \ + php8 \ + php8-fpm \ + php8-mysqli \ + nginx + +RUN docker-php-ext-install pdo pdo_mysql mysqli +RUN docker-php-ext-enable pdo_mysql + +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +COPY nginx.conf /etc/nginx/nginx.conf +#+end_src + diff --git a/containers/web/Dockerfile b/containers/web/Dockerfile new file mode 100644 index 0000000..8eec44f --- /dev/null +++ b/containers/web/Dockerfile @@ -0,0 +1,15 @@ +FROM php:8.1.4-fpm-alpine3.14 +WORKDIR /var/www/html + +RUN apk update && apk add --no-cache \ + php8 \ + php8-fpm \ + php8-mysqli \ + nginx + +RUN docker-php-ext-install pdo pdo_mysql mysqli +RUN docker-php-ext-enable pdo_mysql + +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + +COPY nginx.conf /etc/nginx/nginx.conf diff --git a/containers/web/nginx.conf b/containers/web/nginx.conf new file mode 100644 index 0000000..47c8257 --- /dev/null +++ b/containers/web/nginx.conf @@ -0,0 +1,26 @@ +events { + worker_connections 1024; +} + +http { + server { + listen 80 default_server; + listen [::]:80 default_server; + + root /var/www/html; + + index index.php index.html index.htm index.nginx-debian.html; + + server_name _; + + location / { + try_files $uri $uri/ =404; + } + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + include fastcgi.conf; + } + } +} -- 2.52.0