diff options
author | VirtualTam <virtualtam+github@flibidi.net> | 2017-10-21 18:00:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-21 18:00:08 +0200 |
commit | 72cfe44436f4316112fc4aabfe8940aa7b4adcab (patch) | |
tree | e72c757a2cfa157fd47911fb759cbed18ec747b2 /docker/alpine/nginx.conf | |
parent | 1f40141a6992af6620962cba98b72f14de076615 (diff) | |
parent | e3a3cc0da85925d08df29a2146b54b4159d5a14b (diff) | |
download | Shaarli-72cfe44436f4316112fc4aabfe8940aa7b4adcab.tar.gz Shaarli-72cfe44436f4316112fc4aabfe8940aa7b4adcab.tar.zst Shaarli-72cfe44436f4316112fc4aabfe8940aa7b4adcab.zip |
Merge pull request #846 from virtualtam/docker/alpine
Docker: switch to Alpine Linux
Diffstat (limited to 'docker/alpine/nginx.conf')
-rw-r--r-- | docker/alpine/nginx.conf | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/docker/alpine/nginx.conf b/docker/alpine/nginx.conf new file mode 100644 index 00000000..07fba33f --- /dev/null +++ b/docker/alpine/nginx.conf | |||
@@ -0,0 +1,73 @@ | |||
1 | user nginx nginx; | ||
2 | daemon off; | ||
3 | worker_processes 4; | ||
4 | pid /var/run/nginx.pid; | ||
5 | |||
6 | events { | ||
7 | worker_connections 768; | ||
8 | } | ||
9 | |||
10 | http { | ||
11 | include mime.types; | ||
12 | default_type application/octet-stream; | ||
13 | keepalive_timeout 20; | ||
14 | |||
15 | client_max_body_size 10m; | ||
16 | |||
17 | index index.html index.php; | ||
18 | |||
19 | server { | ||
20 | listen 80; | ||
21 | root /var/www/shaarli; | ||
22 | |||
23 | access_log /var/log/nginx/shaarli.access.log; | ||
24 | error_log /var/log/nginx/shaarli.error.log; | ||
25 | |||
26 | location ~ /\. { | ||
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 | ||
42 | expires max; | ||
43 | add_header Pragma public; | ||
44 | add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | ||
45 | } | ||
46 | |||
47 | location = /favicon.ico { | ||
48 | # serve the Shaarli favicon from its custom location | ||
49 | alias /var/www/shaarli/images/favicon.ico; | ||
50 | } | ||
51 | |||
52 | location / { | ||
53 | # Slim - rewrite URLs | ||
54 | try_files $uri /index.php$is_args$args; | ||
55 | } | ||
56 | |||
57 | location ~ (index)\.php$ { | ||
58 | # Slim - split URL path into (script_filename, path_info) | ||
59 | try_files $uri =404; | ||
60 | fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
61 | |||
62 | # filter and proxy PHP requests to PHP-FPM | ||
63 | fastcgi_pass unix:/var/run/php-fpm.sock; | ||
64 | fastcgi_index index.php; | ||
65 | include fastcgi.conf; | ||
66 | } | ||
67 | |||
68 | location ~ \.php$ { | ||
69 | # deny access to all other PHP scripts | ||
70 | deny all; | ||
71 | } | ||
72 | } | ||
73 | } | ||