dolibarr/dev/setup/apache/virtualhost

121 lines
3.7 KiB
Text
Raw Permalink Normal View History

2017-11-03 12:25:49 +00:00
<VirtualHost *:80>
2022-01-30 00:03:07 +00:00
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
2022-12-19 12:06:29 +00:00
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
2025-09-02 20:28:31 +00:00
2022-01-30 00:03:07 +00:00
php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
2022-11-15 10:00:33 +00:00
2025-09-02 20:28:31 +00:00
2022-11-15 10:00:33 +00:00
# Add this to use a custom apparmor profile when using apache php handler
2022-12-19 12:06:29 +00:00
<IfModule mod_apparmor.c>
AADefaultHatName sellyoursaas-instances
</IfModule>
2022-11-15 10:00:33 +00:00
2025-09-02 20:28:31 +00:00
2023-02-11 12:29:21 +00:00
# The URLs of the web site
2022-01-30 00:03:07 +00:00
ServerName myvirtualalias
ServerAlias myvirtualalias
2025-09-02 20:28:31 +00:00
2022-01-30 00:03:07 +00:00
UseCanonicalName On
2025-09-02 20:28:31 +00:00
2022-01-30 00:03:07 +00:00
KeepAlive On
KeepAliveTimeout 5
MaxKeepAliveRequests 20
2025-09-02 20:28:31 +00:00
2022-01-30 00:03:07 +00:00
AddDefaultCharset UTF-8
2025-09-02 20:28:31 +00:00
2023-02-11 12:29:21 +00:00
# Detect if we are using DoliDroid
#SetEnvIf User-Agent DoliDroid dolidroid
2025-09-02 20:28:31 +00:00
2023-02-11 12:29:21 +00:00
# The directory and permissions for the web site
DocumentRoot "/home/.../htdocs"
2022-01-30 00:03:07 +00:00
<Directory /home/.../htdocs/>
AllowOverride None
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
Require all granted
2017-11-03 12:25:49 +00:00
2025-09-02 20:28:31 +00:00
# To restrict access by a HTTP basic auth
2022-01-30 00:03:07 +00:00
#AuthType Basic
#AuthName "Authenticate to backoffice"
#AuthUserFile /etc/apache2/.htpasswd
#require valid-user
</Directory>
2022-12-19 12:06:29 +00:00
2026-05-26 11:52:34 +00:00
# Leaving /public, /api, /dav and /.well_known directory accessible to everyone (out of the HTTP basic auth if defined)
<Directory /home/admin/wwwroot/dolibarr/htdocs/api/>
2022-01-30 00:03:07 +00:00
AuthType None
Satisfy any
2023-02-11 12:29:21 +00:00
Require all granted
2022-01-30 00:03:07 +00:00
</Directory>
2025-09-02 20:28:31 +00:00
<Directory /home/admin/wwwroot/dolibarr/htdocs/dav/>
2022-01-30 00:03:07 +00:00
AuthType None
Satisfy any
2023-02-11 12:29:21 +00:00
Require all granted
2022-01-30 00:03:07 +00:00
</Directory>
2026-05-26 11:52:34 +00:00
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
AuthType None
Satisfy any
Require all granted
</Directory>
2025-09-02 20:28:31 +00:00
<Directory /home/admin/wwwroot/dolibarr/htdocs/.well-known/>
2022-01-30 00:03:07 +00:00
AuthType None
Satisfy any
2023-02-11 12:29:21 +00:00
Require all granted
2022-01-30 00:03:07 +00:00
</Directory>
2025-09-02 20:28:31 +00:00
# You may also want to allow access to everyone to wrappers for api, document, viewimage, manifest and public json/img files
2025-09-02 20:28:31 +00:00
# but if you can avoid it, it is better.
<Files /home/admin/wwwroot/dolibarr/htdocs/api/index.php>
2022-01-30 00:03:07 +00:00
AuthType None
Satisfy any
2023-02-11 12:29:21 +00:00
Require all granted
2025-09-02 20:28:31 +00:00
</Files>
2022-01-30 00:03:07 +00:00
<Files ~ "(document\.php|viewimage\.php|\.js\.php|\.json\.php|\.js|\.css\.php|\.css|\.gif|\.png|\.svg|\.woff2|favicon\.ico)$">
AuthType None
Satisfy any
2023-02-11 12:29:21 +00:00
Require all granted
2022-01-30 00:03:07 +00:00
</Files>
2017-11-03 12:25:49 +00:00
2023-02-11 12:29:21 +00:00
2025-09-02 20:28:31 +00:00
# Log directives
2022-01-30 00:03:07 +00:00
ErrorLog /var/log/apache2/myvirtualalias_error_log
TransferLog /var/log/apache2/myvirtualalias_access_log
2025-09-02 20:28:31 +00:00
2023-02-11 12:29:21 +00:00
# Compress is done on resources of type php pages, text file export, css and javascript
2022-01-30 00:03:07 +00:00
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
AddType text/javascript .jgz
AddEncoding gzip .jgz
2023-02-11 12:29:21 +00:00
# Add cache performance directives
2022-01-30 00:03:07 +00:00
ExpiresActive On
ExpiresByType image/x-icon A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/css A2592000
ExpiresByType text/javascript A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType application/javascript A2592000
2025-09-02 20:28:31 +00:00
2023-02-11 12:29:21 +00:00
# To enable the SSL if the certificate file exists
<IfFile "/etc/letsencrypt/live/www.mydomain.com/cert.pem">
SSLEngine On
2025-09-02 20:28:31 +00:00
2023-02-11 12:29:21 +00:00
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
2025-09-02 20:28:31 +00:00
2023-02-11 12:29:21 +00:00
#RewriteEngine on
#RewriteCond %{SERVER_PORT} ^80$
#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
</IfFile>
2025-09-02 20:28:31 +00:00
2017-11-03 12:25:49 +00:00
</VirtualHost>