Difference between revisions of "Webserver"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
m
Tag: 2017 source edit
(all in the same language, English)
Tag: 2017 source edit
Line 12: Line 12:
 
=Example of setup of a virtual host file for Nginx=
 
=Example of setup of a virtual host file for Nginx=
  
Voici un fichier de configuration Nginx qui fonctionne en HTTPS pour Debian 11, PHP7.4, Nginx 1.18 et Dolibarr 14 :
+
Here is a configuration file for Nginx working in HTTPS on Debian 11, PHP7.4, Nginx 1.18 et Dolibarr 14 :
  
 
<blockquote>server {
 
<blockquote>server {

Revision as of 07:22, 29 September 2021

A Webserver is necessary for running Dolibarr.

Usually the Apache 2 Webserver is used but you can also use Nginx, or any Web server with PHP support available.


Example of setup of a virtual host file for Apache

TODO...


Example of setup of a virtual host file for Nginx

Here is a configuration file for Nginx working in HTTPS on Debian 11, PHP7.4, Nginx 1.18 et Dolibarr 14 :

server {

       root /var/www/dolibarr/htdocs;

       index index.html index.php;

       server_name dolibarr.example.fr;

       location / {

               try_files $uri $uri/ =404;

       }

       location ~ [^/]\.php(/|$) {

               fastcgi_intercept_errors on;

               include         fastcgi_params;

               fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;

               fastcgi_param   SCRIPT_NAME $fastcgi_script_name;

               fastcgi_pass unix:/run/php/php7.4-fpm.sock;

       }

   listen [::]:443 ssl ipv6only=on;

   listen 443 ssl;

   ssl_certificate /etc/letsencrypt/live/dolibarr.example.fr/fullchain.pem;

   ssl_certificate_key /etc/letsencrypt/live/dolibarr.example.fr/privkey.pem;

   include /etc/letsencrypt/options-ssl-nginx.conf;

   ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

   error_log /var/log/nginx/dolibarr.example.fr/error.log warn;

   access_log /var/log/nginx/dolibarr.example.fr/access.log;

}

server {

   if ($host = dolibarr.example.fr) {

       return 301 https://$host$request_uri;

   }

       listen [::]:80;

       listen 80;

       server_name dolibarr.example.fr;

       return 404;

}