X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=doc%2FServer-configuration.html;h=2f1c25b50f0ff78c6953cea7d87f0f5d4b790238;hb=6b7ddb487126fd8f5be22e729ec8e0a2b639891b;hp=de6bf488cec95b7289bbb1c6ef6437e6a9d8c463;hpb=992af0b9d77cb4fbac2c37ef8d5896042d67a2a3;p=github%2Fshaarli%2FShaarli.git diff --git a/doc/Server-configuration.html b/doc/Server-configuration.html index de6bf488..2f1c25b5 100644 --- a/doc/Server-configuration.html +++ b/doc/Server-configuration.html @@ -4,45 +4,69 @@ -
Example virtual host configurations for popular web servers
Related guides:
make-ssl-cert generate-default-snakeoil --force-overwrite
will create /etc/ssl/certs/ssl-cert-snakeoil.pem
and /etc/ssl/private/ssl-cert-snakeoil.key
If Shaarli is served behind a proxy (i.e. there is a proxy server between clients and the web server hosting Shaarli), please refer to the proxy server documentation for proper configuration. In particular, you have to ensure that the following server variables are properly set:
+X-Forwarded-Proto
;X-Forwarded-Host
;X-Forwarded-For
.See also proxy-related issues.
<VirtualHost *:80>
+<VirtualHost *:80>
ServerName shaarli.my-domain.org
DocumentRoot /absolute/path/to/shaarli/
-</VirtualHost>
+</VirtualHost>
Debug - Log all the things!
This configuration will log both Apache and PHP errors, which may prove useful to identify server configuration errors.
See:
- Apache/PHP - error log per VirtualHost (StackOverflow)
-- PHP: php_value vs php_admin_value and the use of php_flag explained
+- PHP: php_value vs php_admin_value and the use of php_flag explained
-<VirtualHost *:80>
+<VirtualHost *:80>
ServerName shaarli.my-domain.org
DocumentRoot /absolute/path/to/shaarli/
- LogLevel warn
+ LogLevel warn
ErrorLog /var/log/apache2/shaarli-error.log
CustomLog /var/log/apache2/shaarli-access.log combined
@@ -118,45 +154,48 @@ code > span.er { color: #ff0000; font-weight: bold; }
php_flag display_errors on
php_value error_reporting 2147483647
php_value error_log /var/log/apache2/shaarli-php-error.log
-</VirtualHost>
+</VirtualHost>
Standard - Keep access and error logs
-<VirtualHost *:80>
+<VirtualHost *:80>
ServerName shaarli.my-domain.org
DocumentRoot /absolute/path/to/shaarli/
- LogLevel warn
+ LogLevel warn
ErrorLog /var/log/apache2/shaarli-error.log
CustomLog /var/log/apache2/shaarli-access.log combined
-</VirtualHost>
+</VirtualHost>
Paranoid - Redirect HTTP (:80) to HTTPS (:443)
See Server-side TLS (Mozilla).
-<VirtualHost *:443>
+<VirtualHost *:443>
ServerName shaarli.my-domain.org
DocumentRoot /absolute/path/to/shaarli/
- SSLEngine on
- SSLCertificateFile /absolute/path/to/the/website/certificate.crt
+ SSLEngine on
+ SSLCertificateFile /absolute/path/to/the/website/certificate.pem
SSLCertificateKeyFile /absolute/path/to/the/website/key.key
- <Directory /absolute/path/to/shaarli/>
- AllowOverride All
- Options Indexes FollowSymLinks MultiViews
- Order allow,deny
+ <Directory /absolute/path/to/shaarli/>
+ AllowOverride All
+ Options Indexes FollowSymLinks MultiViews
+ Order allow,deny
allow from all
</Directory>
- LogLevel warn
+ LogLevel warn
ErrorLog /var/log/apache2/shaarli-error.log
CustomLog /var/log/apache2/shaarli-access.log combined
</VirtualHost>
-<VirtualHost *:80>
+<VirtualHost *:80>
ServerName shaarli.my-domain.org
Redirect 301 / https://shaarli.my-domain.org
- LogLevel warn
+ LogLevel warn
ErrorLog /var/log/apache2/shaarli-error.log
CustomLog /var/log/apache2/shaarli-access.log combined
-</VirtualHost>
+</VirtualHost>
+.htaccess
+Shaarli use .htaccess
Apache files to deny access to files that shouldn't be directly accessed (datastore, config, etc.). You need the directive AllowOverride All
in your virtual host configuration for them to work.
+Warning: If you use Apache 2.2 or lower, you need mod_version to be installed and enabled.
LightHttpd
Nginx
Foreword
@@ -197,24 +236,42 @@ code > span.er { color: #ff0000; font-weight: bold; }
files may be located in a user's home directory
in this case, make sure both Nginx and PHP-FPM are running as the local user/group!
-For all following examples, a development configuration will be used:
+For all following configuration examples, this user/group pair will be used:
user:group = john:users
,
which corresponds to the following service configuration:
-; /etc/php/php-fpm.conf
+; /etc/php/php-fpm.conf
user = john
group = users
[...][](.html)
listen.owner = john
-listen.group = users
+listen.group = users
# /etc/nginx/nginx.conf
user john users;
http {
[...][](.html)
}
+(Optional) Increase the maximum file upload size
+Some bookmark dumps generated by web browsers can be huge due to the presence of Base64-encoded images and favicons, as well as extra verbosity when nesting links in (sub-)folders.
+To increase upload size, you will need to modify both nginx and PHP configuration:
+# /etc/nginx/nginx.conf
+
+http {
+ [...][](.html)
+
+ client_max_body_size 10m;
+
+ [...][](.html)
+}
+# /etc/php5/fpm/php.ini
+
+[...][](.html)
+post_max_size = 10M
+[...][](.html)
+upload_max_filesize = 10M
Minimal
WARNING: Use for development only!
user john users;
@@ -278,10 +335,15 @@ location ~ ~$ {
}
# /etc/nginx/php.conf
location ~ (index)\.php$ {
- # proxy PHP requests to PHP-FPM
+ # filter and proxy PHP requests to PHP-FPM
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
+}
+
+location ~ \.php$ {
+ # deny access to all other PHP scripts
+ deny all;
}
# /etc/nginx/static_assets.conf
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
@@ -309,6 +371,11 @@ http {
error_log /var/log/nginx/shaarli.error.log;
}
+ location = /shaarli/favicon.ico {
+ # serve the Shaarli favicon from its custom location
+ alias /var/www/shaarli/images/favicon.ico;
+ }
+
include deny.conf;
include static_assets.conf;
include php.conf;
@@ -362,6 +429,11 @@ http {
error_log /var/log/nginx/shaarli.error.log;
}
+ location = /shaarli/favicon.ico {
+ # serve the Shaarli favicon from its custom location
+ alias /var/www/shaarli/images/favicon.ico;
+ }
+
include deny.conf;
include static_assets.conf;
include php.conf;