質問編集履歴

2

version: '2' services: api-php-fpm: build: php-fpm container_name: api-php-fpm

2020/06/11 12:55

投稿

nyonozi
nyonozi

スコア1

test CHANGED
File without changes
test CHANGED
@@ -22,6 +22,64 @@
22
22
 
23
23
 
24
24
 
25
+ #### Dockerfile
26
+
27
+ ```
28
+
29
+ FROM debian:jessie
30
+
31
+
32
+
33
+ RUN apt-get update && \
34
+
35
+ apt-get install -y nginx && \
36
+
37
+ apt-get clean && \
38
+
39
+ rm -rf /var/lib/apt/lists/*
40
+
41
+
42
+
43
+ COPY docker/nginx/nginx.conf /etc/nginx/
44
+
45
+ COPY docker/nginx/app.conf /etc/nginx/sites-available/
46
+
47
+
48
+
49
+ RUN ln -s /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/app
50
+
51
+ RUN rm /etc/nginx/sites-enabled/default
52
+
53
+
54
+
55
+ RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf
56
+
57
+
58
+
59
+ RUN usermod -u 1000 www-data
60
+
61
+
62
+
63
+ COPY --chown=www-data:www-data ./src /var/www/html
64
+
65
+
66
+
67
+ CMD ["nginx"]
68
+
69
+
70
+
71
+ EXPOSE 80
72
+
73
+ EXPOSE 443
74
+
75
+
76
+
77
+ ```
78
+
79
+
80
+
81
+ #### app.conf
82
+
25
83
  ```
26
84
 
27
85
  server {
@@ -82,57 +140,75 @@
82
140
 
83
141
  ```
84
142
 
85
- ```
86
-
87
- FROM debian:jessie
88
-
89
-
90
-
91
- RUN apt-get update && \
92
-
93
- apt-get install -y nginx && \
94
-
95
- apt-get clean && \
96
-
97
- rm -rf /var/lib/apt/lists/*
98
-
99
-
100
-
101
- COPY docker/nginx/nginx.conf /etc/nginx/
102
-
103
- COPY docker/nginx/app.conf /etc/nginx/sites-available/
104
-
105
-
106
-
107
- RUN ln -s /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/app
108
-
109
- RUN rm /etc/nginx/sites-enabled/default
110
-
111
-
112
-
113
- RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf
114
-
115
-
116
-
117
- RUN usermod -u 1000 www-data
118
-
119
-
120
-
121
- COPY --chown=www-data:www-data ./src /var/www/html
122
-
123
-
124
-
125
- CMD ["nginx"]
126
-
127
-
128
-
129
- EXPOSE 80
130
-
131
- EXPOSE 443
132
-
133
-
134
-
135
- ```
143
+ #### nginx.conf
144
+
145
+ ```
146
+
147
+ user www-data;
148
+
149
+ worker_processes 4;
150
+
151
+ pid /run/nginx.pid;
152
+
153
+
154
+
155
+ events {
156
+
157
+ worker_connections 2048;
158
+
159
+ multi_accept on;
160
+
161
+ use epoll;
162
+
163
+ }
164
+
165
+
166
+
167
+ http {
168
+
169
+ server_tokens off;
170
+
171
+ sendfile on;
172
+
173
+ tcp_nopush on;
174
+
175
+ tcp_nodelay on;
176
+
177
+ keepalive_timeout 15;
178
+
179
+ types_hash_max_size 2048;
180
+
181
+ include /etc/nginx/mime.types;
182
+
183
+ default_type application/octet-stream;
184
+
185
+ access_log off;
186
+
187
+ error_log off;
188
+
189
+ gzip on;
190
+
191
+ gzip_disable "msie6";
192
+
193
+ include /etc/nginx/conf.d/*.conf;
194
+
195
+ include /etc/nginx/sites-enabled/*;
196
+
197
+ open_file_cache max=100;
198
+
199
+ }
200
+
201
+
202
+
203
+ daemon off;
204
+
205
+
206
+
207
+ ```
208
+
209
+
210
+
211
+
136
212
 
137
213
 
138
214
 

1

RUN echo "upstream php-upstream { server php-fpm:9000; }" > RUN echo "upstream php-upstream { server

2020/06/11 12:55

投稿

nyonozi
nyonozi

スコア1

test CHANGED
File without changes
test CHANGED
@@ -82,6 +82,58 @@
82
82
 
83
83
  ```
84
84
 
85
+ ```
86
+
87
+ FROM debian:jessie
88
+
89
+
90
+
91
+ RUN apt-get update && \
92
+
93
+ apt-get install -y nginx && \
94
+
95
+ apt-get clean && \
96
+
97
+ rm -rf /var/lib/apt/lists/*
98
+
99
+
100
+
101
+ COPY docker/nginx/nginx.conf /etc/nginx/
102
+
103
+ COPY docker/nginx/app.conf /etc/nginx/sites-available/
104
+
105
+
106
+
107
+ RUN ln -s /etc/nginx/sites-available/app.conf /etc/nginx/sites-enabled/app
108
+
109
+ RUN rm /etc/nginx/sites-enabled/default
110
+
111
+
112
+
113
+ RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf
114
+
115
+
116
+
117
+ RUN usermod -u 1000 www-data
118
+
119
+
120
+
121
+ COPY --chown=www-data:www-data ./src /var/www/html
122
+
123
+
124
+
125
+ CMD ["nginx"]
126
+
127
+
128
+
129
+ EXPOSE 80
130
+
131
+ EXPOSE 443
132
+
133
+
134
+
135
+ ```
136
+
85
137
 
86
138
 
87
139
  ### 試したこと