File tree Expand file tree Collapse file tree 5 files changed +130
-1
lines changed Expand file tree Collapse file tree 5 files changed +130
-1
lines changed Original file line number Diff line number Diff line change
1
+ .idea
Original file line number Diff line number Diff line change
1
+ FROM nginx:alpine
2
+ LABEL "com.example.vendor" ="Neontribe"
3
+ LABEL version="1.0"
4
+ LABEL description="Nginx alpine image built to reverse proxy requests to a PHP FPM server"
5
+
6
+ ADD nginx_default.conf /etc/nginx/conf.d/default.conf
7
+
8
+ ENV PORT=80
9
+ ENV SEVER_NAME=nginx.local
10
+ ENV FPM_TARGET=kimai:9000
11
+ ENV SERVER_ROOT=/opt/kimai
12
+
13
+ # docker build --rm -t tobybatch/nginx-fpm-reverse-proxy .
Original file line number Diff line number Diff line change 1
- # nginx-fpm-reverse-proxy
1
+ # nginx-fpm-reverse-proxy
2
+
3
+ A simple reverse proxy to forward requests on to a PHP FPM Server.
4
+
5
+ Built for use in the Kimai project it can be used for any PHP FPM server.
6
+
7
+ ## Quickstart
8
+
9
+ docker run \
10
+ -ti \
11
+ --rm \
12
+ -name nginx-fpm-reverse-proxy \
13
+ -v ${pwd}:/opt/kimai \
14
+ -p 8001:80 \
15
+ tobybatch/nginx-fpm-reverse-proxy
16
+
17
+ ## Building
18
+
19
+ There is no build time customisation:
20
+
21
+ docker build .
22
+
23
+ ## Environment varaibles
24
+
25
+ * ` PORT=80 `
26
+
27
+ Which port the nginx server should listen on. It will also need to be set at with ` -p $PORT:80 ` at run time.
28
+
29
+ * ` SEVER_NAME=nginx.local `
30
+
31
+ The server name directive used by the nginx server
32
+
33
+ * ` FPM_TARGET=kimai:9000 `
34
+
35
+ Where the PHP FPM server is
36
+
37
+ * ` SERVER_ROOT=/opt/kimai `
38
+
39
+ What to use as the document root, We need this to be set (as read only) so that nginx can server static files.
40
+
41
+ ### Docker compose
42
+
43
+ See [ docker-compose.yml] ( ./docker-compose.yml )
Original file line number Diff line number Diff line change
1
+ version : ' 3.5'
2
+ services :
3
+
4
+ # THIS RUNS A LOCAL NGINX PROXY TO A LOCAL KIMAI RUNNING IN DEV MODE
5
+
6
+ nginx :
7
+ image : tobybatch/nginx-fpm-reverse-proxy
8
+ ports :
9
+ - 8001:80
10
+ volumes :
11
+ - public:/opt/kimai/public:ro
12
+ restart : unless-stopped
13
+ depends_on :
14
+ - kimai
15
+
16
+ kimai :
17
+ image : kimai/kimai2:fpm-latest-dev
18
+ environment :
19
+ - DATABASE_URL=mysql://kimaiuser:kimaipassword@sqldb/kimai
20
+ volumes :
21
+ - public:/opt/kimai/public
22
+ restart : unless-stopped
23
+
24
+ # Needed for Kimai
25
+ sqldb :
26
+ image : mariadb
27
+ environment :
28
+ - MYSQL_DATABASE=kimai
29
+ - MYSQL_USER=kimaiuser
30
+ - MYSQL_PASSWORD=kimaipassword
31
+ - MYSQL_ROOT_PASSWORD=changemeplease
32
+ volumes :
33
+ - /var/lib/mysql
34
+ command : --default-storage-engine innodb
35
+ restart : unless-stopped
36
+
37
+ volumes :
38
+ public :
39
+ sqldb :
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen ${PORT};
3
+ index index.php;
4
+ server_name ${SEVER_NAME};
5
+ root ${SERVER_ROOT};
6
+
7
+ # cache static asset files
8
+ location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
9
+ expires max ;
10
+ log_not_found off ;
11
+ }
12
+
13
+ # for health checks
14
+ location /health {
15
+ return 200 'alive' ;
16
+ add_header Content-Type text/plain;
17
+ }
18
+
19
+ location / {
20
+ try_files $uri $uri / /index.php$is_args$args ;
21
+ }
22
+
23
+ location ~ ^/index\.php(/|$) {
24
+ fastcgi_pass ${FPM_TARGET};
25
+ fastcgi_split_path_info ^(.+\.php)(/.*)$ ;
26
+ include fastcgi_params;
27
+ fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name ;
28
+ fastcgi_param DOCUMENT_ROOT $realpath_root ;
29
+ internal ;
30
+ }
31
+ }
32
+
33
+ # mkdir -p .vim/syntax && wget -O .vim/syntax/nginx.vim http://www.vim.org/scripts/download_script.php\?src_id\=19394
34
+ # vim: set syntax=nginx ft=nginx:
You can’t perform that action at this time.
0 commit comments