Browse Source

init

master
aligator 1 year ago
commit
d2635504fd
9 changed files with 168 additions and 0 deletions
  1. 0
    0
      .gitignore
  2. 27
    0
      Dockerfile
  3. 6
    0
      README.md
  4. 16
    0
      docker-compose.yml
  5. 37
    0
      nginx/default.conf
  6. 31
    0
      nginx/nginx.conf
  7. 45
    0
      php/fpm-pool.conf
  8. 2
    0
      php/php.ini
  9. 4
    0
      start_services.sh

+ 0
- 0
.gitignore View File


+ 27
- 0
Dockerfile View File

@@ -0,0 +1,27 @@
1
+FROM alpine:latest
2
+MAINTAINER aligator <aligator@suncraft-server.de>
3
+
4
+ARG user
5
+ARG gid
6
+ARG uid
7
+ENV SSH_USER=${user}
8
+ENV GROUP_GID=${gid}
9
+ENV USER_UID=${uid}
10
+
11
+RUN apk add --no-cache --update-cache nginx php7 php7-fpm php7-curl php7-ctype php7-dom php7-gd php7-json php7-mbstring php7-openssl php7-session php7-simplexml php7-zip php7-xml php7-apcu php7-opcache && \
12
+    addgroup -g $GROUP_GID http && \
13
+    adduser -D -u $USER_UID -s /sbin/nologin -G http http && \
14
+    mkdir -p /tmp/nginx/client-body
15
+
16
+# configure nginx
17
+COPY nginx/nginx.conf /etc/nginx/nginx.conf
18
+COPY nginx/default.conf /etc/nginx/conf.d/default.conf
19
+
20
+# configure php-fpm
21
+COPY php/fpm-pool.conf /etc/php7/php-fpm.d/zzz_custom.conf
22
+COPY php/php.ini /etc/php7/conf.d/zzz_custom.ini
23
+
24
+COPY start_services.sh /start_services.sh
25
+
26
+CMD ["/start_services.sh"]
27
+

+ 6
- 0
README.md View File

@@ -0,0 +1,6 @@
1
+###How to use:
2
+1. change the volume to use in docker-compose.yaml
3
+1. change uid and gid in docker-compose.yaml
4
+1. update nginx/default.conf as needed
5
+1. docker-compose build
6
+1. docker-compose up

+ 16
- 0
docker-compose.yml View File

@@ -0,0 +1,16 @@
1
+version: '3'
2
+services:
3
+  nginx:
4
+    build:
5
+      context: .
6
+      args:
7
+        - uid=1001
8
+        - gid=1001
9
+    volumes:
10
+      - my-vol:/usr/share/nginx
11
+    ports:
12
+      - "3000:80"
13
+
14
+volumes:
15
+  my-vol:
16
+    external: true

+ 37
- 0
nginx/default.conf View File

@@ -0,0 +1,37 @@
1
+server {
2
+	listen 80 default_server;
3
+	listen [::]:80 default_server;	
4
+
5
+	root /usr/share/nginx/;
6
+
7
+	# Add index.php to the list if you are using PHP
8
+	index index.html index.htm index.php index.nginx-debian.html;
9
+
10
+	server_name _;
11
+
12
+	location / {
13
+		# First attempt to serve request as file, then
14
+		# as directory, then fall back to displaying a 404.
15
+		try_files $uri $uri/ =404;
16
+	}
17
+
18
+	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
19
+	#
20
+	
21
+	location ~ \.php$ {
22
+		try_files $uri =404;
23
+
24
+		fastcgi_pass unix:/var/run/php7-fpm.sock;
25
+		fastcgi_index index.php;
26
+		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
27
+
28
+		include fastcgi_params;
29
+	}
30
+
31
+	# deny access to .htaccess files, if Apache's document root
32
+	# concurs with nginx's one
33
+	#
34
+	location ~ /\.ht {
35
+		deny all;
36
+	}
37
+}

+ 31
- 0
nginx/nginx.conf View File

@@ -0,0 +1,31 @@
1
+user http http;
2
+worker_processes auto;
3
+#error_log /var/log/nginx/error.log;
4
+error_log /proc/self/fd/1;
5
+
6
+pid /run/nginx.pid;
7
+
8
+events {
9
+	worker_connections 1024;
10
+}
11
+
12
+http {
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
+	#access_log /var/log/nginx/access.log main;
17
+	access_log /proc/self/fd/1;
18
+	
19
+	sendfile            on;
20
+	tcp_nopush          on;
21
+	tcp_nodelay         on;
22
+	keepalive_timeout   65;
23
+	types_hash_max_size 2048;
24
+
25
+	include       /etc/nginx/mime.types;
26
+    	default_type  application/octet-stream;
27
+
28
+	#gzip  on;
29
+
30
+	include /etc/nginx/conf.d/*.conf;
31
+}

+ 45
- 0
php/fpm-pool.conf View File

@@ -0,0 +1,45 @@
1
+[global]
2
+; Log to stderr
3
+;error_log = /dev/stderr
4
+error_log = /proc/self/fd/1
5
+
6
+[www]
7
+; Enable status page
8
+pm.status_path = /fpm-status
9
+
10
+; Ondemand process manager
11
+pm = ondemand
12
+
13
+; The number of child processes to be created when pm is set to 'static' and the
14
+; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
15
+; This value sets the limit on the number of simultaneous requests that will be
16
+; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
17
+; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
18
+; CGI. The below defaults are based on a server without much resources. Don't
19
+; forget to tweak pm.* to fit your needs.
20
+; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
21
+; Note: This value is mandatory.
22
+pm.max_children = 50
23
+
24
+; The number of seconds after which an idle process will be killed.
25
+; Note: Used only when pm is set to 'ondemand'
26
+; Default Value: 10s
27
+pm.process_idle_timeout = 10s;
28
+
29
+; The number of requests each child process should execute before respawning.
30
+; This can be useful to work around memory leaks in 3rd party libraries. For
31
+; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
32
+; Default Value: 0
33
+pm.max_requests = 500
34
+
35
+; Make sure the FPM workers can reach the environment variables for configuration
36
+clear_env = no
37
+
38
+; Catch output from PHP
39
+catch_workers_output = yes
40
+
41
+listen = /var/run/php7-fpm.sock
42
+listen.owner = http
43
+listen.group = http
44
+listen.mode = 0660
45
+user = http

+ 2
- 0
php/php.ini View File

@@ -0,0 +1,2 @@
1
+[Date]
2
+date.timezone="UTC"

+ 4
- 0
start_services.sh View File

@@ -0,0 +1,4 @@
1
+#!/bin/sh
2
+
3
+php-fpm7 -D
4
+nginx -g "daemon off;"

Loading…
Cancel
Save