X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=doc%2FServer-configuration.html;h=0e6b220a6cab29241fcf27e51b1b196ba0bb2201;hb=d5d22a6d07917865c44148ad76f43c65a929a890;hp=e1edf557af264cd9c9583b53c24f8b4bf866b899;hpb=86deafe0ff5a22a37255546cf82325e89bf272b1;p=github%2Fshaarli%2FShaarli.git diff --git a/doc/Server-configuration.html b/doc/Server-configuration.html index e1edf557..0e6b220a 100644 --- a/doc/Server-configuration.html +++ b/doc/Server-configuration.html @@ -52,29 +52,28 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
@@ -134,7 +133,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf

See also proxy-related issues.

Apache

Minimal

-
<VirtualHost *:80>
+
<VirtualHost *:80>
     ServerName   shaarli.my-domain.org
     DocumentRoot /absolute/path/to/shaarli/
 </VirtualHost>
@@ -145,11 +144,11 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
  • Apache/PHP - error log per VirtualHost (StackOverflow)
  • 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
     
    @@ -159,43 +158,47 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
         php_value error_log /var/log/apache2/shaarli-php-error.log
     </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>

    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
    +    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>
    +

    .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.

    +

    Apache module mod_rewrite must be enabled to use the REST API. URL rewriting rules for the Slim microframework are stated in the root .htaccess file.

    LightHttpd

    Nginx

    Foreword

    @@ -236,7 +239,7 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf
  • 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,
    @@ -254,6 +257,24 @@ 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,11 +299,14 @@ http {
             error_log   /var/log/nginx/error.log;
     
             location /shaarli/ {
    +            try_files $uri /shaarli/index.php$is_args$args;
                 access_log  /var/log/nginx/shaarli.access.log;
                 error_log   /var/log/nginx/shaarli.error.log;
             }
     
             location ~ (index)\.php$ {
    +            try_files $uri =404;
    +            fastcgi_split_path_info ^(.+\.php)(/.+)$;
                 fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
                 fastcgi_index  index.php;
                 include        fastcgi.conf;
    @@ -317,6 +341,10 @@ location ~ ~$ {
     }
    # /etc/nginx/php.conf
     location ~ (index)\.php$ {
    +    # Slim - split URL path into (script_filename, path_info)
    +    try_files $uri =404;
    +    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    +
         # filter and proxy PHP requests to PHP-FPM
         fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
         fastcgi_index  index.php;
    @@ -349,10 +377,18 @@ http {
             server_name  my.first.domain.org;
     
             location /shaarli/ {
    +            # Slim - rewrite URLs
    +            try_files $uri /shaarli/index.php$is_args$args;
    +
                 access_log  /var/log/nginx/shaarli.access.log;
                 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;
    @@ -402,19 +438,22 @@ http {
             ssl_certificate_key  /home/john/ssl/localhost.key;
     
             location /shaarli/ {
    +            # Slim - rewrite URLs
    +            try_files $uri /index.php$is_args$args;
    +
                 access_log  /var/log/nginx/shaarli.access.log;
                 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;
         }
     }
    -

    Restricting search engines and web crawler traffic

    -

    Creating a robots.txt witht he following contents at the root of your Shaarli installation will prevent "honest" web crawlers from indexing each and every link and Daily page from a Shaarli instance, thus getting rid of a certain amount of unsollicited network traffic.

    -
    User-agent: *
    -Disallow: /
    -

    See: http://www.robotstxt.org/, http://www.robotstxt.org/robotstxt.html, http://www.robotstxt.org/meta.html