diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | docker-compose.yml | 17 | ||||
-rw-r--r-- | docker/nginx/nginx.conf | 89 | ||||
-rw-r--r-- | docker/php/Dockerfile | 10 |
4 files changed, 119 insertions, 0 deletions
@@ -36,3 +36,6 @@ | |||
36 | # Data for wallabag | 36 | # Data for wallabag |
37 | data/assets/* | 37 | data/assets/* |
38 | data/db/wallabag*.sqlite | 38 | data/db/wallabag*.sqlite |
39 | |||
40 | # Docker container logs | ||
41 | docker/logs/ | ||
diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..bc469419 --- /dev/null +++ b/docker-compose.yml | |||
@@ -0,0 +1,17 @@ | |||
1 | nginx: | ||
2 | image: nginx | ||
3 | ports: | ||
4 | - "8080:80" | ||
5 | volumes: | ||
6 | - ./docker/nginx/nginx.conf:/nginx.conf | ||
7 | - ./docker/logs/nginx:/var/log/nginx | ||
8 | - .:/var/www/html | ||
9 | links: | ||
10 | - php:php | ||
11 | command: nginx -c /nginx.conf | ||
12 | php: | ||
13 | build: docker/php | ||
14 | ports: | ||
15 | - "9000:9000" | ||
16 | volumes: | ||
17 | - .:/var/www/html | ||
diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf new file mode 100644 index 00000000..7e82a0f8 --- /dev/null +++ b/docker/nginx/nginx.conf | |||
@@ -0,0 +1,89 @@ | |||
1 | user nginx; | ||
2 | worker_processes 1; | ||
3 | pid /var/run/nginx.pid; | ||
4 | |||
5 | events { | ||
6 | worker_connections 2048; | ||
7 | multi_accept on; | ||
8 | use epoll; | ||
9 | } | ||
10 | |||
11 | http { | ||
12 | |||
13 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
14 | '$status $body_bytes_sent "$http_referer" ' | ||
15 | '"$http_user_agent" "$http_x_forwarded_for"'; | ||
16 | |||
17 | access_log /var/log/nginx/access.log main; | ||
18 | |||
19 | server_tokens off; | ||
20 | sendfile on; | ||
21 | tcp_nopush on; | ||
22 | tcp_nodelay on; | ||
23 | keepalive_timeout 15; | ||
24 | types_hash_max_size 2048; | ||
25 | include /etc/nginx/mime.types; | ||
26 | default_type application/octet-stream; | ||
27 | access_log off; | ||
28 | error_log off; | ||
29 | gzip on; | ||
30 | gzip_disable "msie6"; | ||
31 | open_file_cache max=100; | ||
32 | |||
33 | |||
34 | upstream php-upstream { | ||
35 | server php:9000; | ||
36 | } | ||
37 | |||
38 | server { | ||
39 | #server_name domain.tld www.domain.tld; | ||
40 | root /var/www/html/web; | ||
41 | |||
42 | location / { | ||
43 | # try to serve file directly, fallback to app.php | ||
44 | try_files $uri /app.php$is_args$args; | ||
45 | } | ||
46 | # DEV | ||
47 | # This rule should only be placed on your development environment | ||
48 | # In production, don't include this and don't deploy app_dev.php or config.php | ||
49 | location ~ ^/(app_dev|config)\.php(/|$) { | ||
50 | fastcgi_pass php-upstream; | ||
51 | fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
52 | include fastcgi_params; | ||
53 | # When you are using symlinks to link the document root to the | ||
54 | # current version of your application, you should pass the real | ||
55 | # application path instead of the path to the symlink to PHP | ||
56 | # FPM. | ||
57 | # Otherwise, PHP's OPcache may not properly detect changes to | ||
58 | # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | ||
59 | # for more information). | ||
60 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
61 | fastcgi_param DOCUMENT_ROOT $realpath_root; | ||
62 | } | ||
63 | # PROD | ||
64 | location ~ ^/app\.php(/|$) { | ||
65 | fastcgi_pass php-upstream; | ||
66 | fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
67 | include fastcgi_params; | ||
68 | # When you are using symlinks to link the document root to the | ||
69 | # current version of your application, you should pass the real | ||
70 | # application path instead of the path to the symlink to PHP | ||
71 | # FPM. | ||
72 | # Otherwise, PHP's OPcache may not properly detect changes to | ||
73 | # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | ||
74 | # for more information). | ||
75 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | ||
76 | fastcgi_param DOCUMENT_ROOT $realpath_root; | ||
77 | # Prevents URIs that include the front controller. This will 404: | ||
78 | # http://domain.tld/app.php/some-path | ||
79 | # Remove the internal directive to allow URIs like this | ||
80 | internal; | ||
81 | } | ||
82 | |||
83 | error_log /var/log/nginx/project_error.log; | ||
84 | access_log /var/log/nginx/project_access.log; | ||
85 | } | ||
86 | |||
87 | } | ||
88 | |||
89 | daemon off; | ||
diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile new file mode 100644 index 00000000..7c56ae57 --- /dev/null +++ b/docker/php/Dockerfile | |||
@@ -0,0 +1,10 @@ | |||
1 | FROM php:fpm | ||
2 | |||
3 | RUN apt-get update && apt-get install -y \ | ||
4 | libmcrypt-dev libicu-dev libpq-dev libxml2-dev \ | ||
5 | && docker-php-ext-install \ | ||
6 | iconv mcrypt mbstring intl pdo pdo_mysql pdo_pgsql | ||
7 | |||
8 | RUN usermod -u 1000 www-data | ||
9 | |||
10 | CMD ["php-fpm"] | ||