質問編集履歴
2
version: '2' services: api-php-fpm: build: php-fpm container_name: api-php-fpm
title
CHANGED
File without changes
|
body
CHANGED
@@ -10,7 +10,36 @@
|
|
10
10
|
|
11
11
|
### 該当のソースコード
|
12
12
|
|
13
|
+
#### Dockerfile
|
13
14
|
```
|
15
|
+
FROM debian:jessie
|
16
|
+
|
17
|
+
RUN apt-get update && \
|
18
|
+
apt-get install -y nginx && \
|
19
|
+
apt-get clean && \
|
20
|
+
rm -rf /var/lib/apt/lists/*
|
21
|
+
|
22
|
+
COPY docker/nginx/nginx.conf /etc/nginx/
|
23
|
+
COPY docker/nginx/app.conf /etc/nginx/sites-available/
|
24
|
+
|
25
|
+
RUN ln -s /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/app
|
26
|
+
RUN rm /etc/nginx/sites-enabled/default
|
27
|
+
|
28
|
+
RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf
|
29
|
+
|
30
|
+
RUN usermod -u 1000 www-data
|
31
|
+
|
32
|
+
COPY --chown=www-data:www-data ./src /var/www/html
|
33
|
+
|
34
|
+
CMD ["nginx"]
|
35
|
+
|
36
|
+
EXPOSE 80
|
37
|
+
EXPOSE 443
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
#### app.conf
|
42
|
+
```
|
14
43
|
server {
|
15
44
|
root /var/www/html;
|
16
45
|
|
@@ -40,33 +69,42 @@
|
|
40
69
|
}
|
41
70
|
|
42
71
|
```
|
72
|
+
#### nginx.conf
|
43
73
|
```
|
74
|
+
user www-data;
|
44
|
-
|
75
|
+
worker_processes 4;
|
76
|
+
pid /run/nginx.pid;
|
45
77
|
|
46
|
-
|
78
|
+
events {
|
47
|
-
apt-get install -y nginx && \
|
48
|
-
|
79
|
+
worker_connections 2048;
|
49
|
-
|
80
|
+
multi_accept on;
|
50
|
-
|
51
|
-
|
81
|
+
use epoll;
|
52
|
-
|
82
|
+
}
|
53
83
|
|
84
|
+
http {
|
85
|
+
server_tokens off;
|
86
|
+
sendfile on;
|
87
|
+
tcp_nopush on;
|
88
|
+
tcp_nodelay on;
|
89
|
+
keepalive_timeout 15;
|
90
|
+
types_hash_max_size 2048;
|
91
|
+
include /etc/nginx/mime.types;
|
92
|
+
default_type application/octet-stream;
|
93
|
+
access_log off;
|
94
|
+
error_log off;
|
95
|
+
gzip on;
|
96
|
+
gzip_disable "msie6";
|
54
|
-
|
97
|
+
include /etc/nginx/conf.d/*.conf;
|
55
|
-
|
98
|
+
include /etc/nginx/sites-enabled/*;
|
99
|
+
open_file_cache max=100;
|
100
|
+
}
|
56
101
|
|
57
|
-
|
102
|
+
daemon off;
|
58
103
|
|
59
|
-
|
104
|
+
```
|
60
105
|
|
61
|
-
COPY --chown=www-data:www-data ./src /var/www/html
|
62
106
|
|
63
|
-
CMD ["nginx"]
|
64
107
|
|
65
|
-
EXPOSE 80
|
66
|
-
EXPOSE 443
|
67
|
-
|
68
|
-
```
|
69
|
-
|
70
108
|
### 試したこと
|
71
109
|
|
72
110
|
`fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;`
|
1
RUN echo "upstream php-upstream { server php-fpm:9000; }" > RUN echo "upstream php-upstream { server
title
CHANGED
File without changes
|
body
CHANGED
@@ -40,7 +40,33 @@
|
|
40
40
|
}
|
41
41
|
|
42
42
|
```
|
43
|
+
```
|
44
|
+
FROM debian:jessie
|
43
45
|
|
46
|
+
RUN apt-get update && \
|
47
|
+
apt-get install -y nginx && \
|
48
|
+
apt-get clean && \
|
49
|
+
rm -rf /var/lib/apt/lists/*
|
50
|
+
|
51
|
+
COPY docker/nginx/nginx.conf /etc/nginx/
|
52
|
+
COPY docker/nginx/app.conf /etc/nginx/sites-available/
|
53
|
+
|
54
|
+
RUN ln -s /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/app
|
55
|
+
RUN rm /etc/nginx/sites-enabled/default
|
56
|
+
|
57
|
+
RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf
|
58
|
+
|
59
|
+
RUN usermod -u 1000 www-data
|
60
|
+
|
61
|
+
COPY --chown=www-data:www-data ./src /var/www/html
|
62
|
+
|
63
|
+
CMD ["nginx"]
|
64
|
+
|
65
|
+
EXPOSE 80
|
66
|
+
EXPOSE 443
|
67
|
+
|
68
|
+
```
|
69
|
+
|
44
70
|
### 試したこと
|
45
71
|
|
46
72
|
`fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;`
|