# Installation de Mosparo sur Debian 11 avec RP Nginx en frontend. ## Installation des paquets ``` apt install nginx php-fpm php-common php-dom php-intl php-json php-mysql php-zip mariadb-server zip unzip locales wget ``` ## Configuration de la BDD ``` mysql -u root CREATE DATABASE mosparo; CREATE USER 'mosparo'@localhost IDENTIFIED BY 'SUPERPASSWORD'; GRANT ALL PRIVILEGES ON mosparo.* TO 'mosparo'@'localhost'; FLUSH PRIVILEGES; ``` ## Récupération de l'application ``` mkdir /var/www/mosparo cd /var/www/mosparo wget https://github.com/mosparo/mosparo/releases/download/v0.3.3/mosparo-stable-v0.3.3.zip unzip mosparo-stable-v0.3.3.zip chown -R www-data. /var/www/mosparo ``` ## Configuration de Nginx Sur le serveur où va être installée l'application. Fichier de conf Nginx : **/etc/nginx/sites-enabled/default** ``` server { listen 80; server_name _; root /var/www/mosparo/public; index index.php; location = /favicon.ico { # Optional log_not_found off; access_log off; } location = /robots.txt { # Optional allow all; log_not_found off; access_log off; } location / { # Required try_files $uri $uri/ /index.php?$args; } location ~ ^/resources/(.*)/(.*)\.css$ { # Required try_files $uri $uri/ /index.php?$args; log_not_found off; expires max; } location ~ \.php$ { # Required include fastcgi_params; fastcgi_intercept_errors on; fastcgi_pass unix:/run/php/php7.4-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location ~* \.(js|png|jpg|jpeg|gif|ico)$ { # Optional expires max; log_not_found off; } } ``` ## Configuration du RP Nginx Sur le reverse-proxy ``` upstream srvmosparo { server IPSERVEURNGINX:80; keepalive 64; } server { server_name FQDN; listen 443 ssl http2; ..... location / { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://srvmosparo/; } } ``` ## Finalisation Se connecter à l'URL puis finaliser l'installation (BDD, premier user...)