aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.docker/nginx.conf43
-rw-r--r--.dockerignore11
-rw-r--r--.htaccess2
-rw-r--r--doc/md/Docker.md7
-rw-r--r--doc/md/Server-configuration.md42
-rw-r--r--docker-compose.yml9
6 files changed, 49 insertions, 65 deletions
diff --git a/.docker/nginx.conf b/.docker/nginx.conf
index 023f52c1..30810a87 100644
--- a/.docker/nginx.conf
+++ b/.docker/nginx.conf
@@ -17,27 +17,13 @@ http {
17 index index.html index.php; 17 index index.html index.php;
18 18
19 server { 19 server {
20 listen 80; 20 listen 80;
21 root /var/www/shaarli; 21 root /var/www/shaarli;
22 22
23 access_log /var/log/nginx/shaarli.access.log; 23 access_log /var/log/nginx/shaarli.access.log;
24 error_log /var/log/nginx/shaarli.error.log; 24 error_log /var/log/nginx/shaarli.error.log;
25 25
26 location ~ /\. { 26 location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|oet|woff2?)$ {
27 # deny access to dotfiles
28 access_log off;
29 log_not_found off;
30 deny all;
31 }
32
33 location ~ ~$ {
34 # deny access to temp editor files, e.g. "script.php~"
35 access_log off;
36 log_not_found off;
37 deny all;
38 }
39
40 location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
41 # cache static assets 27 # cache static assets
42 expires max; 28 expires max;
43 add_header Pragma public; 29 add_header Pragma public;
@@ -49,30 +35,25 @@ http {
49 alias /var/www/shaarli/images/favicon.ico; 35 alias /var/www/shaarli/images/favicon.ico;
50 } 36 }
51 37
38 location /doc/html/ {
39 default_type "text/html";
40 try_files $uri $uri/ $uri.html =404;
41 }
42
52 location / { 43 location / {
53 # Slim - rewrite URLs 44 # Slim - rewrite URLs & do NOT serve static files through this location
54 try_files $uri /index.php$is_args$args; 45 try_files _ /index.php$is_args$args;
55 } 46 }
56 47
57 location ~ (index)\.php$ { 48 location ~ index\.php$ {
58 # Slim - split URL path into (script_filename, path_info) 49 # Slim - split URL path into (script_filename, path_info)
59 try_files $uri =404; 50 try_files $uri =404;
60 fastcgi_split_path_info ^(.+\.php)(/.+)$; 51 fastcgi_split_path_info ^(index.php)(/.+)$;
61 52
62 # filter and proxy PHP requests to PHP-FPM 53 # filter and proxy PHP requests to PHP-FPM
63 fastcgi_pass unix:/var/run/php-fpm.sock; 54 fastcgi_pass unix:/var/run/php-fpm.sock;
64 fastcgi_index index.php; 55 fastcgi_index index.php;
65 include fastcgi.conf; 56 include fastcgi.conf;
66 } 57 }
67
68 location ~ /doc/ {
69 default_type "text/html";
70 try_files $uri $uri/ $uri.html =404;
71 }
72
73 location ~ \.php$ {
74 # deny access to all other PHP scripts
75 deny all;
76 }
77 } 58 }
78} 59}
diff --git a/.dockerignore b/.dockerignore
index 96fd31c5..19fd87a5 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -2,8 +2,16 @@
2.dev 2.dev
3.git 3.git
4.github 4.github
5.gitattributes
6.gitignore
7.travis.yml
5tests 8tests
6 9
10# Docker related resources are not needed inside the container
11.dockerignore
12Dockerfile
13Dockerfile.armhf
14
7# Docker Compose resources 15# Docker Compose resources
8docker-compose.yml 16docker-compose.yml
9 17
@@ -13,6 +21,9 @@ data/*
13pagecache/* 21pagecache/*
14tmp/* 22tmp/*
15 23
24# Shaarli's docs are created during the build
25doc/html/
26
16# Eclipse project files 27# Eclipse project files
17.settings 28.settings
18.buildpath 29.buildpath
diff --git a/.htaccess b/.htaccess
index 25fcfb03..9d1522df 100644
--- a/.htaccess
+++ b/.htaccess
@@ -13,7 +13,7 @@ RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
13# Alternative (if the 2 lines above don't work) 13# Alternative (if the 2 lines above don't work)
14# SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 14# SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
15 15
16# REST API 16# Slim URL Redirection
17# Ionos Hosting needs RewriteBase / 17# Ionos Hosting needs RewriteBase /
18# RewriteBase / 18# RewriteBase /
19RewriteCond %{REQUEST_FILENAME} !-f 19RewriteCond %{REQUEST_FILENAME} !-f
diff --git a/doc/md/Docker.md b/doc/md/Docker.md
index c152fe92..fc406c00 100644
--- a/doc/md/Docker.md
+++ b/doc/md/Docker.md
@@ -1,3 +1,4 @@
1
1# Docker 2# Docker
2 3
3[Docker](https://docs.docker.com/get-started/overview/) is an open platform for developing, shipping, and running applications 4[Docker](https://docs.docker.com/get-started/overview/) is an open platform for developing, shipping, and running applications
@@ -113,9 +114,11 @@ $ mkdir shaarli && cd shaarli
113# Download the latest version of Shaarli's docker-compose.yml 114# Download the latest version of Shaarli's docker-compose.yml
114$ curl -L https://raw.githubusercontent.com/shaarli/Shaarli/latest/docker-compose.yml -o docker-compose.yml 115$ curl -L https://raw.githubusercontent.com/shaarli/Shaarli/latest/docker-compose.yml -o docker-compose.yml
115# Create the .env file and fill in your VPS and domain information 116# Create the .env file and fill in your VPS and domain information
116# (replace <MY_SHAARLI_DOMAIN> and <MY_CONTACT_EMAIL> with your actual information) 117# (replace <shaarli.mydomain.org>, <admin@mydomain.org> and <latest> with your actual information)
117$ echo 'SHAARLI_VIRTUAL_HOST=shaarli.mydomain.org' > .env 118$ echo 'SHAARLI_VIRTUAL_HOST=shaarli.mydomain.org' > .env
118$ echo 'SHAARLI_LETSENCRYPT_EMAIL=admin@mydomain.org' >> .env 119$ echo 'SHAARLI_LETSENCRYPT_EMAIL=admin@mydomain.org' >> .env
120# Available Docker tags can be found at https://hub.docker.com/r/shaarli/shaarli/tags
121$ echo 'SHAARLI_DOCKER_TAG=latest' >> .env
119# Pull the Docker images 122# Pull the Docker images
120$ docker-compose pull 123$ docker-compose pull
121# Run! 124# Run!
@@ -224,4 +227,4 @@ $ docker system prune
224- [docker pull](https://docs.docker.com/engine/reference/commandline/pull/) 227- [docker pull](https://docs.docker.com/engine/reference/commandline/pull/)
225- [docker run](https://docs.docker.com/engine/reference/commandline/run/) 228- [docker run](https://docs.docker.com/engine/reference/commandline/run/)
226- [docker-compose logs](https://docs.docker.com/compose/reference/logs/) 229- [docker-compose logs](https://docs.docker.com/compose/reference/logs/)
227- Træfik: [Getting Started](https://docs.traefik.io/), [Docker backend](https://docs.traefik.io/configuration/backends/docker/), [Let's Encrypt](https://docs.traefik.io/user-guide/docker-and-lets-encrypt/), [Docker image](https://hub.docker.com/_/traefik/) \ No newline at end of file 230- Træfik: [Getting Started](https://docs.traefik.io/), [Docker backend](https://docs.traefik.io/configuration/backends/docker/), [Let's Encrypt](https://docs.traefik.io/user-guide/docker-and-lets-encrypt/), [Docker image](https://hub.docker.com/_/traefik/)
diff --git a/doc/md/Server-configuration.md b/doc/md/Server-configuration.md
index 4e74d80b..a49b6033 100644
--- a/doc/md/Server-configuration.md
+++ b/doc/md/Server-configuration.md
@@ -193,19 +193,24 @@ sudo nano /etc/apache2/sites-available/shaarli.mydomain.org.conf
193 Require all granted 193 Require all granted
194 </Directory> 194 </Directory>
195 195
196 <LocationMatch "/\."> 196 # BE CAREFUL: directives order matter!
197 # Prevent accessing dotfiles
198 RedirectMatch 404 ".*"
199 </LocationMatch>
200 197
201 <LocationMatch "\.(?:ico|css|js|gif|jpe?g|png)$"> 198 <FilesMatch ".*\.(?!(ico|css|js|gif|jpe?g|png|ttf|oet|woff2?)$)[^\.]*$">
199 Require all denied
200 </FilesMatch>
201
202 <Files "index.php">
203 Require all granted
204 </Files>
205
206 <FilesMatch "\.(?:ico|css|js|gif|jpe?g|png|ttf|oet|woff2)$">
202 # allow client-side caching of static files 207 # allow client-side caching of static files
203 Header set Cache-Control "max-age=2628000, public, must-revalidate, proxy-revalidate" 208 Header set Cache-Control "max-age=2628000, public, must-revalidate, proxy-revalidate"
204 </LocationMatch> 209 </FilesMatch>
210
205 211
206 # serve the Shaarli favicon from its custom location 212 # serve the Shaarli favicon from its custom location
207 Alias favicon.ico /var/www/shaarli.mydomain.org/images/favicon.ico 213 Alias favicon.ico /var/www/shaarli.mydomain.org/images/favicon.ico
208
209</VirtualHost> 214</VirtualHost>
210``` 215```
211 216
@@ -296,7 +301,7 @@ server {
296 location / { 301 location / {
297 # default index file when no file URI is requested 302 # default index file when no file URI is requested
298 index index.php; 303 index index.php;
299 try_files $uri /index.php$is_args$args; 304 try_files _ /index.php$is_args$args;
300 } 305 }
301 306
302 location ~ (index)\.php$ { 307 location ~ (index)\.php$ {
@@ -309,23 +314,7 @@ server {
309 include fastcgi.conf; 314 include fastcgi.conf;
310 } 315 }
311 316
312 location ~ \.php$ { 317 location ~ /doc/html/ {
313 # deny access to all other PHP scripts
314 # disable this if you host other PHP applications on the same virtualhost
315 deny all;
316 }
317
318 location ~ /\. {
319 # deny access to dotfiles
320 deny all;
321 }
322
323 location ~ ~$ {
324 # deny access to temp editor files, e.g. "script.php~"
325 deny all;
326 }
327
328 location ~ /doc/ {
329 default_type "text/html"; 318 default_type "text/html";
330 try_files $uri $uri/ $uri.html =404; 319 try_files $uri $uri/ $uri.html =404;
331 } 320 }
@@ -336,13 +325,12 @@ server {
336 } 325 }
337 326
338 # allow client-side caching of static files 327 # allow client-side caching of static files
339 location ~* \.(?:ico|css|js|gif|jpe?g|png)$ { 328 location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|oet|woff2?)$ {
340 expires max; 329 expires max;
341 add_header Cache-Control "public, must-revalidate, proxy-revalidate"; 330 add_header Cache-Control "public, must-revalidate, proxy-revalidate";
342 # HTTP 1.0 compatibility 331 # HTTP 1.0 compatibility
343 add_header Pragma public; 332 add_header Pragma public;
344 } 333 }
345
346} 334}
347``` 335```
348 336
diff --git a/docker-compose.yml b/docker-compose.yml
index a3de4b1c..4ebae447 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,12 +2,13 @@
2# Shaarli - Docker Compose example configuration 2# Shaarli - Docker Compose example configuration
3# 3#
4# See: 4# See:
5# - https://shaarli.readthedocs.io/en/master/docker/shaarli-images/ 5# - https://shaarli.readthedocs.io/en/master/Docker/#docker-compose
6# - https://shaarli.readthedocs.io/en/master/guides/install-shaarli-with-debian9-and-docker/
7# 6#
8# Environment variables: 7# Environment variables:
9# - SHAARLI_VIRTUAL_HOST Fully Qualified Domain Name for the Shaarli instance 8# - SHAARLI_VIRTUAL_HOST Fully Qualified Domain Name for the Shaarli instance
10# - SHAARLI_LETSENCRYPT_EMAIL Contact email for certificate renewal 9# - SHAARLI_LETSENCRYPT_EMAIL Contact email for certificate renewal
10# - SHAARLI_DOCKER_TAG Shaarli docker tag to use
11# See: https://hub.docker.com/r/shaarli/shaarli/tags
11version: '3' 12version: '3'
12 13
13networks: 14networks:
@@ -20,7 +21,7 @@ volumes:
20 21
21services: 22services:
22 shaarli: 23 shaarli:
23 image: shaarli/shaarli:master 24 image: shaarli/shaarli:${SHAARLI_DOCKER_TAG}
24 build: ./ 25 build: ./
25 networks: 26 networks:
26 - http-proxy 27 - http-proxy
@@ -40,7 +41,7 @@ services:
40 - "--entrypoints=Name:https Address::443 TLS" 41 - "--entrypoints=Name:https Address::443 TLS"
41 - "--retry" 42 - "--retry"
42 - "--docker" 43 - "--docker"
43 - "--docker.domain=docker.localhost" 44 - "--docker.domain=${SHAARLI_VIRTUAL_HOST}"
44 - "--docker.exposedbydefault=true" 45 - "--docker.exposedbydefault=true"
45 - "--docker.watch=true" 46 - "--docker.watch=true"
46 - "--acme" 47 - "--acme"