質問編集履歴
12
訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
nginxとunicornとec2でRailsアプリをデプロイしたい。
|
3
3
|
[参考したQiita](http://qiita.com/iwaseasahi/items/72c43bd932ad5cc2d206)
|
4
4
|
|
5
|
-
`[
|
5
|
+
`[user](/var/www/projects/***) $ sudo cat /etc/nginx/conf.d/***.conf`
|
6
6
|
|
7
7
|
```
|
8
8
|
|
9
9
|
upstream unicorn_server {
|
10
|
-
server unix:/var/www/projects/
|
10
|
+
server unix:/var/www/projects/***/tmp/sockets/.unicorn.sock
|
11
11
|
fail_timeout=0;
|
12
12
|
}
|
13
13
|
|
@@ -19,10 +19,10 @@
|
|
19
19
|
keepalive_timeout 5;
|
20
20
|
|
21
21
|
# Location of our static files
|
22
|
-
root /var/www/projects/
|
22
|
+
root /var/www/projects/***/public;
|
23
23
|
|
24
24
|
location ~ ^/assets/ {
|
25
|
-
root /var/www/projects/
|
25
|
+
root /var/www/projects/***/public;
|
26
26
|
}
|
27
27
|
|
28
28
|
location / {
|
@@ -38,20 +38,20 @@
|
|
38
38
|
|
39
39
|
error_page 500 502 503 504 /500.html;
|
40
40
|
location = /500.html {
|
41
|
-
root /var/www/projects/
|
41
|
+
root /var/www/projects/***/public;
|
42
42
|
}
|
43
43
|
}
|
44
44
|
|
45
45
|
```
|
46
46
|
|
47
|
-
`[
|
47
|
+
`[user](/var/www/projects/***) $ cat config/unicorn.conf.rb`
|
48
48
|
|
49
49
|
```
|
50
50
|
|
51
51
|
# set lets
|
52
52
|
$worker = 2
|
53
53
|
$timeout = 30
|
54
|
-
$app_dir = "/var/www/projects/
|
54
|
+
$app_dir = "/var/www/projects/***"
|
55
55
|
$listen = File.expand_path 'tmp/sockets/.unicorn.sock', $app_dir
|
56
56
|
$pid = File.expand_path 'tmp/pids/unicorn.pid', $app_dir
|
57
57
|
$std_log = File.expand_path 'log/unicorn.log', $app_dir
|
11
nginxとunicorn設定ファイル
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,100 +2,50 @@
|
|
2
2
|
nginxとunicornとec2でRailsアプリをデプロイしたい。
|
3
3
|
[参考したQiita](http://qiita.com/iwaseasahi/items/72c43bd932ad5cc2d206)
|
4
4
|
|
5
|
+
`[asobi](/var/www/projects/offisee) $ sudo cat /etc/nginx/conf.d/offisee.conf`
|
5
6
|
|
6
|
-
# エラーログ
|
7
|
-
|
8
|
-
`nginx`のエラーログ
|
9
|
-
`$ sudo tail -f /var/log/nginx/error.log`
|
10
|
-
|
11
7
|
```
|
12
8
|
|
13
|
-
[error] 2913#0: *1 open() "/usr/share/nginx/html/favicon.ico" failed (2: No such file or directory), client: 125.0.109.71,server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "52.199.206.175", referrer: "http://52.199.206.175/"
|
14
|
-
[crit] 29690#0: *1 connect() to unix:/var/www/projects/offisee/tmp/sockets/.unicorn.sock failed (2: No such file or directory) while connecting to upstream, client: 125.0.109.71, server: 52.199.206.175, request: "GET / HTTP/1.1", upstream: "http://unix:/var/www/projects/offisee/tmp/sockets/.unicorn.sock:/", host: "52.199.206.175"
|
15
|
-
[alert] 30160#0: *1 open socket #3 left in connection 3
|
16
|
-
[alert] 30160#0: *2 open socket #12 left in connection 4
|
17
|
-
[alert] 30160#0: aborting
|
18
|
-
[error] 2793#0: *583 open() "/usr/share/nginx/html/azenv.php" failed (2: No such file or directory), client: 10.0.0.206, server: localhost, request: "POST /azenv.php?auth=150231231239&a=PSCMN&i=885413847&p=80 HTTP/1.1", host: "check.proxyradar.com", referrer: "https://proxyradar.com/"
|
19
|
-
|
20
|
-
```
|
21
|
-
|
22
|
-
`unicorn`のログで気になる部分は、
|
23
|
-
`$ cat {アプリ}/log/unicorn.log`
|
24
|
-
|
25
|
-
```
|
26
|
-
|
27
|
-
unlinking existing socket=/var/www/projects/offisee/tmp/sockets/.unicorn.sock
|
28
|
-
listening on addr=/var/www/projects/offisee/tmp/sockets/.unicorn.sock fd=11
|
29
|
-
|
30
|
-
```
|
31
|
-
|
32
|
-
|
33
|
-
`nginx`の設定ファイル
|
34
|
-
|
35
|
-
```
|
36
|
-
|
37
|
-
[/etc/nginx] $ ls
|
38
|
-
conf.d fastcgi.conf fastcgi_params koi-utf mime.types nginx.conf scgi_params uwsgi_params win-utf
|
39
|
-
default.d fastcgi.conf.default fastcgi_params.default koi-win mime.types.default nginx.conf.default scgi_params.default uwsgi_params.default
|
40
|
-
|
41
|
-
[/etc/nginx/conf.d] $ ls
|
42
|
-
アプリ名.conf virtual.conf
|
43
|
-
↑
|
44
|
-
この部分のみ新規編集しています。
|
45
|
-
|
46
|
-
```
|
47
|
-
|
48
|
-
# 設定ファイル
|
49
|
-
|
50
|
-
`/etc/nginx/conf.d/{アプリ名}.conf`
|
51
|
-
|
52
|
-
```
|
53
|
-
|
54
|
-
|
55
9
|
upstream unicorn_server {
|
56
|
-
|
10
|
+
server unix:/var/www/projects/offisee/tmp/sockets/.unicorn.sock
|
57
|
-
|
11
|
+
fail_timeout=0;
|
58
12
|
}
|
59
13
|
|
60
14
|
server {
|
61
|
-
|
15
|
+
listen 80;
|
62
|
-
|
16
|
+
client_max_body_size 4G;
|
63
|
-
|
17
|
+
server_name 54.65.226.96;
|
64
18
|
|
65
|
-
|
19
|
+
keepalive_timeout 5;
|
66
20
|
|
67
|
-
|
21
|
+
# Location of our static files
|
68
|
-
|
22
|
+
root /var/www/projects/offisee/public;
|
69
23
|
|
70
|
-
|
24
|
+
location ~ ^/assets/ {
|
71
|
-
|
25
|
+
root /var/www/projects/offisee/public;
|
72
|
-
|
26
|
+
}
|
73
27
|
|
74
|
-
|
28
|
+
location / {
|
75
|
-
|
29
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
76
|
-
|
30
|
+
proxy_set_header Host $http_host;
|
77
|
-
|
31
|
+
proxy_redirect off;
|
78
32
|
|
79
|
-
|
33
|
+
if (!-f $request_filename) {
|
80
|
-
|
34
|
+
proxy_pass http://unicorn_server;
|
81
|
-
|
35
|
+
break;
|
82
|
-
|
36
|
+
}
|
83
|
-
|
37
|
+
}
|
84
38
|
|
85
|
-
|
39
|
+
error_page 500 502 503 504 /500.html;
|
86
|
-
|
40
|
+
location = /500.html {
|
87
|
-
|
41
|
+
root /var/www/projects/offisee/public;
|
88
|
-
|
42
|
+
}
|
89
43
|
}
|
90
44
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
45
|
```
|
95
46
|
|
47
|
+
`[asobi](/var/www/projects/offisee) $ cat config/unicorn.conf.rb`
|
96
48
|
|
97
|
-
`{アプリ名}/config/unicorn.conf.rb`
|
98
|
-
|
99
49
|
```
|
100
50
|
|
101
51
|
# set lets
|
@@ -131,204 +81,4 @@
|
|
131
81
|
defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
|
132
82
|
end
|
133
83
|
|
134
|
-
|
135
|
-
```
|
84
|
+
```
|
136
|
-
|
137
|
-
# お願い
|
138
|
-
|
139
|
-
`error`のログを見て、何か思い当たる点があるかた、
|
140
|
-
ぜひ教えていただけないでしょうか。
|
141
|
-
現在は`IPアドレス`にアクセスしてもサーバーが応答しない状態です。
|
142
|
-
|
143
|
-
# 追伸(nginx.confとnginx.conf.defaultの状態)
|
144
|
-
以下2つは編集を行っておらず、デフォルトのままです。
|
145
|
-
文字数の関係で設定例コメントアウト箇所を一部省略しました。
|
146
|
-
|
147
|
-
`nginx.conf`
|
148
|
-
|
149
|
-
```
|
150
|
-
|
151
|
-
# For more information on configuration, see:
|
152
|
-
# * Official English Documentation: http://nginx.org/en/docs/
|
153
|
-
# * Official Russian Documentation: http://nginx.org/ru/docs/
|
154
|
-
|
155
|
-
user nginx;
|
156
|
-
worker_processes auto;
|
157
|
-
error_log /var/log/nginx/error.log;
|
158
|
-
pid /var/run/nginx.pid;
|
159
|
-
|
160
|
-
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
|
161
|
-
include /usr/share/nginx/modules/*.conf;
|
162
|
-
|
163
|
-
events {
|
164
|
-
worker_connections 1024;
|
165
|
-
}
|
166
|
-
|
167
|
-
http {
|
168
|
-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
169
|
-
'$status $body_bytes_sent "$http_referer" '
|
170
|
-
'"$http_user_agent" "$http_x_forwarded_for"';
|
171
|
-
|
172
|
-
access_log /var/log/nginx/access.log main;
|
173
|
-
|
174
|
-
sendfile on;
|
175
|
-
tcp_nopush on;
|
176
|
-
tcp_nodelay on;
|
177
|
-
keepalive_timeout 65;
|
178
|
-
types_hash_max_size 2048;
|
179
|
-
|
180
|
-
include /etc/nginx/mime.types;
|
181
|
-
default_type application/octet-stream;
|
182
|
-
|
183
|
-
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
184
|
-
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
185
|
-
# for more information.
|
186
|
-
include /etc/nginx/conf.d/*.conf;
|
187
|
-
|
188
|
-
index index.html index.htm;
|
189
|
-
|
190
|
-
server {
|
191
|
-
listen 80 default_server;
|
192
|
-
listen [::]:80 default_server;
|
193
|
-
server_name localhost;
|
194
|
-
root /usr/share/nginx/html;
|
195
|
-
|
196
|
-
|
197
|
-
# Load configuration files for the default server block.
|
198
|
-
include /etc/nginx/default.d/*.conf;
|
199
|
-
|
200
|
-
location / {
|
201
|
-
}
|
202
|
-
|
203
|
-
# redirect server error pages to the static page /40x.html
|
204
|
-
#
|
205
|
-
error_page 404 /404.html;
|
206
|
-
location = /40x.html {
|
207
|
-
}
|
208
|
-
|
209
|
-
# redirect server error pages to the static page /50x.html
|
210
|
-
#
|
211
|
-
error_page 500 502 503 504 /50x.html;
|
212
|
-
location = /50x.html {
|
213
|
-
}
|
214
|
-
|
215
|
-
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
216
|
-
#
|
217
|
-
#location ~ \.php$ {
|
218
|
-
# proxy_pass http://127.0.0.1;
|
219
|
-
#}
|
220
|
-
|
221
|
-
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
222
|
-
#
|
223
|
-
#location ~ \.php$ {
|
224
|
-
# root html;
|
225
|
-
# fastcgi_pass 127.0.0.1:9000;
|
226
|
-
# fastcgi_index index.php;
|
227
|
-
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
228
|
-
# include fastcgi_params;
|
229
|
-
#}
|
230
|
-
|
231
|
-
# deny access to .htaccess files, if Apache's document root
|
232
|
-
# concurs with nginx's one
|
233
|
-
#
|
234
|
-
#location ~ /\.ht {
|
235
|
-
# deny all;
|
236
|
-
#}
|
237
|
-
}
|
238
|
-
|
239
|
-
}
|
240
|
-
|
241
|
-
|
242
|
-
```
|
243
|
-
|
244
|
-
`nginx.conf.default`
|
245
|
-
|
246
|
-
```
|
247
|
-
|
248
|
-
#user nobody;
|
249
|
-
worker_processes 1;
|
250
|
-
|
251
|
-
#error_log logs/error.log;
|
252
|
-
#error_log logs/error.log notice;
|
253
|
-
#error_log logs/error.log info;
|
254
|
-
|
255
|
-
#pid logs/nginx.pid;
|
256
|
-
|
257
|
-
|
258
|
-
events {
|
259
|
-
worker_connections 1024;
|
260
|
-
}
|
261
|
-
|
262
|
-
|
263
|
-
http {
|
264
|
-
include mime.types;
|
265
|
-
default_type application/octet-stream;
|
266
|
-
|
267
|
-
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
268
|
-
# '$status $body_bytes_sent "$http_referer" '
|
269
|
-
# '"$http_user_agent" "$http_x_forwarded_for"';
|
270
|
-
|
271
|
-
#access_log logs/access.log main;
|
272
|
-
|
273
|
-
sendfile on;
|
274
|
-
#tcp_nopush on;
|
275
|
-
|
276
|
-
#keepalive_timeout 0;
|
277
|
-
keepalive_timeout 65;
|
278
|
-
|
279
|
-
#gzip on;
|
280
|
-
|
281
|
-
server {
|
282
|
-
listen 80;
|
283
|
-
server_name localhost;
|
284
|
-
|
285
|
-
#charset koi8-r;
|
286
|
-
|
287
|
-
#access_log logs/host.access.log main;
|
288
|
-
|
289
|
-
location / {
|
290
|
-
root html;
|
291
|
-
index index.html index.htm;
|
292
|
-
}
|
293
|
-
|
294
|
-
#error_page 404 /404.html;
|
295
|
-
|
296
|
-
# redirect server error pages to the static page /50x.html
|
297
|
-
#
|
298
|
-
error_page 500 502 503 504 /50x.html;
|
299
|
-
location = /50x.html {
|
300
|
-
root html;
|
301
|
-
}
|
302
|
-
|
303
|
-
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
304
|
-
#
|
305
|
-
#location ~ \.php$ {
|
306
|
-
# proxy_pass http://127.0.0.1;
|
307
|
-
#}
|
308
|
-
|
309
|
-
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
310
|
-
#
|
311
|
-
#location ~ \.php$ {
|
312
|
-
# root html;
|
313
|
-
# fastcgi_pass 127.0.0.1:9000;
|
314
|
-
# fastcgi_index index.php;
|
315
|
-
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
316
|
-
# include fastcgi_params;
|
317
|
-
#}
|
318
|
-
|
319
|
-
# deny access to .htaccess files, if Apache's document root
|
320
|
-
# concurs with nginx's one
|
321
|
-
#
|
322
|
-
#location ~ /\.ht {
|
323
|
-
# deny all;
|
324
|
-
#}
|
325
|
-
}
|
326
|
-
|
327
|
-
}
|
328
|
-
|
329
|
-
|
330
|
-
```
|
331
|
-
|
332
|
-
# 追伸
|
333
|
-
|
334
|
-
](9bd9504794b4eea3a0668aa57d07b655.png)
|
10
ロードバランザー
title
CHANGED
File without changes
|
body
CHANGED
@@ -327,4 +327,8 @@
|
|
327
327
|
}
|
328
328
|
|
329
329
|
|
330
|
-
```
|
330
|
+
```
|
331
|
+
|
332
|
+
# 追伸
|
333
|
+
|
334
|
+
](9bd9504794b4eea3a0668aa57d07b655.png)
|
9
IPアドレスを変えました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -60,7 +60,7 @@
|
|
60
60
|
server {
|
61
61
|
listen 80;
|
62
62
|
client_max_body_size 4G;
|
63
|
-
server_name
|
63
|
+
server_name 54.65.226.96;
|
64
64
|
|
65
65
|
keepalive_timeout 5;
|
66
66
|
|
8
はあ
title
CHANGED
File without changes
|
body
CHANGED
@@ -327,22 +327,4 @@
|
|
327
327
|
}
|
328
328
|
|
329
329
|
|
330
|
-
```
|
330
|
+
```
|
331
|
-
|
332
|
-
# 追伸
|
333
|
-
|
334
|
-
```
|
335
|
-
norito 4009 1 0 03:15 ? 00:00:01 unicorn_rails master -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
336
|
-
norito 4012 4009 0 03:15 ? 00:00:00 unicorn_rails worker[0] -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
337
|
-
norito 4014 4009 0 03:15 ? 00:00:00 unicorn_rails worker[1] -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
338
|
-
```
|
339
|
-
|
340
|
-
# 追伸2
|
341
|
-
|
342
|
-

|
343
|
-
|
344
|
-
# 追伸3
|
345
|
-

|
346
|
-
|
347
|
-
# 追伸4
|
348
|
-

|
7
it work
title
CHANGED
File without changes
|
body
CHANGED
@@ -342,4 +342,7 @@
|
|
342
342
|

|
343
343
|
|
344
344
|
# 追伸3
|
345
|
-

|
345
|
+

|
346
|
+
|
347
|
+
# 追伸4
|
348
|
+

|
6
nginx
title
CHANGED
File without changes
|
body
CHANGED
@@ -339,4 +339,7 @@
|
|
339
339
|
|
340
340
|
# 追伸2
|
341
341
|
|
342
|
-

|
342
|
+

|
343
|
+
|
344
|
+
# 追伸3
|
345
|
+

|
5
アクセス権
title
CHANGED
File without changes
|
body
CHANGED
@@ -335,4 +335,8 @@
|
|
335
335
|
norito 4009 1 0 03:15 ? 00:00:01 unicorn_rails master -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
336
336
|
norito 4012 4009 0 03:15 ? 00:00:00 unicorn_rails worker[0] -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
337
337
|
norito 4014 4009 0 03:15 ? 00:00:00 unicorn_rails worker[1] -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
338
|
-
```
|
338
|
+
```
|
339
|
+
|
340
|
+
# 追伸2
|
341
|
+
|
342
|
+

|
4
ユーザ名を入力
title
CHANGED
File without changes
|
body
CHANGED
@@ -332,7 +332,7 @@
|
|
332
332
|
# 追伸
|
333
333
|
|
334
334
|
```
|
335
|
-
|
335
|
+
norito 4009 1 0 03:15 ? 00:00:01 unicorn_rails master -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
336
|
-
|
336
|
+
norito 4012 4009 0 03:15 ? 00:00:00 unicorn_rails worker[0] -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
337
|
-
|
337
|
+
norito 4014 4009 0 03:15 ? 00:00:00 unicorn_rails worker[1] -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
338
338
|
```
|
3
unicornのプロセスを追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -327,4 +327,12 @@
|
|
327
327
|
}
|
328
328
|
|
329
329
|
|
330
|
+
```
|
331
|
+
|
332
|
+
# 追伸
|
333
|
+
|
334
|
+
```
|
335
|
+
{ユーザ名} 4009 1 0 03:15 ? 00:00:01 unicorn_rails master -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
336
|
+
{ユーザ名} 4012 4009 0 03:15 ? 00:00:00 unicorn_rails worker[0] -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
337
|
+
{ユーザ名} 4014 4009 0 03:15 ? 00:00:00 unicorn_rails worker[1] -c /var/www/projects/offisee/config/unicorn.conf.rb -D -E production
|
330
338
|
```
|
2
誤字脱字
title
CHANGED
File without changes
|
body
CHANGED
@@ -140,15 +140,10 @@
|
|
140
140
|
ぜひ教えていただけないでしょうか。
|
141
141
|
現在は`IPアドレス`にアクセスしてもサーバーが応答しない状態です。
|
142
142
|
|
143
|
-
|
144
143
|
# 追伸(nginx.confとnginx.conf.defaultの状態)
|
145
|
-
|
146
144
|
以下2つは編集を行っておらず、デフォルトのままです。
|
145
|
+
文字数の関係で設定例コメントアウト箇所を一部省略しました。
|
147
146
|
|
148
|
-
# 追伸(nginx.confとnginx.conf.defaultの状態)
|
149
|
-
以下2つは編集を行っておらず、デフォルトのままです。
|
150
|
-
文字数の関係でコメントアウトの部分を一部省略しました。
|
151
|
-
|
152
147
|
`nginx.conf`
|
153
148
|
|
154
149
|
```
|
1
修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -138,4 +138,198 @@
|
|
138
138
|
|
139
139
|
`error`のログを見て、何か思い当たる点があるかた、
|
140
140
|
ぜひ教えていただけないでしょうか。
|
141
|
-
現在は`IPアドレス`にアクセスしてもサーバーが応答しない状態です。
|
141
|
+
現在は`IPアドレス`にアクセスしてもサーバーが応答しない状態です。
|
142
|
+
|
143
|
+
|
144
|
+
# 追伸(nginx.confとnginx.conf.defaultの状態)
|
145
|
+
|
146
|
+
以下2つは編集を行っておらず、デフォルトのままです。
|
147
|
+
|
148
|
+
# 追伸(nginx.confとnginx.conf.defaultの状態)
|
149
|
+
以下2つは編集を行っておらず、デフォルトのままです。
|
150
|
+
文字数の関係でコメントアウトの部分を一部省略しました。
|
151
|
+
|
152
|
+
`nginx.conf`
|
153
|
+
|
154
|
+
```
|
155
|
+
|
156
|
+
# For more information on configuration, see:
|
157
|
+
# * Official English Documentation: http://nginx.org/en/docs/
|
158
|
+
# * Official Russian Documentation: http://nginx.org/ru/docs/
|
159
|
+
|
160
|
+
user nginx;
|
161
|
+
worker_processes auto;
|
162
|
+
error_log /var/log/nginx/error.log;
|
163
|
+
pid /var/run/nginx.pid;
|
164
|
+
|
165
|
+
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
|
166
|
+
include /usr/share/nginx/modules/*.conf;
|
167
|
+
|
168
|
+
events {
|
169
|
+
worker_connections 1024;
|
170
|
+
}
|
171
|
+
|
172
|
+
http {
|
173
|
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
174
|
+
'$status $body_bytes_sent "$http_referer" '
|
175
|
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
176
|
+
|
177
|
+
access_log /var/log/nginx/access.log main;
|
178
|
+
|
179
|
+
sendfile on;
|
180
|
+
tcp_nopush on;
|
181
|
+
tcp_nodelay on;
|
182
|
+
keepalive_timeout 65;
|
183
|
+
types_hash_max_size 2048;
|
184
|
+
|
185
|
+
include /etc/nginx/mime.types;
|
186
|
+
default_type application/octet-stream;
|
187
|
+
|
188
|
+
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
189
|
+
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
190
|
+
# for more information.
|
191
|
+
include /etc/nginx/conf.d/*.conf;
|
192
|
+
|
193
|
+
index index.html index.htm;
|
194
|
+
|
195
|
+
server {
|
196
|
+
listen 80 default_server;
|
197
|
+
listen [::]:80 default_server;
|
198
|
+
server_name localhost;
|
199
|
+
root /usr/share/nginx/html;
|
200
|
+
|
201
|
+
|
202
|
+
# Load configuration files for the default server block.
|
203
|
+
include /etc/nginx/default.d/*.conf;
|
204
|
+
|
205
|
+
location / {
|
206
|
+
}
|
207
|
+
|
208
|
+
# redirect server error pages to the static page /40x.html
|
209
|
+
#
|
210
|
+
error_page 404 /404.html;
|
211
|
+
location = /40x.html {
|
212
|
+
}
|
213
|
+
|
214
|
+
# redirect server error pages to the static page /50x.html
|
215
|
+
#
|
216
|
+
error_page 500 502 503 504 /50x.html;
|
217
|
+
location = /50x.html {
|
218
|
+
}
|
219
|
+
|
220
|
+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
221
|
+
#
|
222
|
+
#location ~ \.php$ {
|
223
|
+
# proxy_pass http://127.0.0.1;
|
224
|
+
#}
|
225
|
+
|
226
|
+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
227
|
+
#
|
228
|
+
#location ~ \.php$ {
|
229
|
+
# root html;
|
230
|
+
# fastcgi_pass 127.0.0.1:9000;
|
231
|
+
# fastcgi_index index.php;
|
232
|
+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
233
|
+
# include fastcgi_params;
|
234
|
+
#}
|
235
|
+
|
236
|
+
# deny access to .htaccess files, if Apache's document root
|
237
|
+
# concurs with nginx's one
|
238
|
+
#
|
239
|
+
#location ~ /\.ht {
|
240
|
+
# deny all;
|
241
|
+
#}
|
242
|
+
}
|
243
|
+
|
244
|
+
}
|
245
|
+
|
246
|
+
|
247
|
+
```
|
248
|
+
|
249
|
+
`nginx.conf.default`
|
250
|
+
|
251
|
+
```
|
252
|
+
|
253
|
+
#user nobody;
|
254
|
+
worker_processes 1;
|
255
|
+
|
256
|
+
#error_log logs/error.log;
|
257
|
+
#error_log logs/error.log notice;
|
258
|
+
#error_log logs/error.log info;
|
259
|
+
|
260
|
+
#pid logs/nginx.pid;
|
261
|
+
|
262
|
+
|
263
|
+
events {
|
264
|
+
worker_connections 1024;
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
http {
|
269
|
+
include mime.types;
|
270
|
+
default_type application/octet-stream;
|
271
|
+
|
272
|
+
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
273
|
+
# '$status $body_bytes_sent "$http_referer" '
|
274
|
+
# '"$http_user_agent" "$http_x_forwarded_for"';
|
275
|
+
|
276
|
+
#access_log logs/access.log main;
|
277
|
+
|
278
|
+
sendfile on;
|
279
|
+
#tcp_nopush on;
|
280
|
+
|
281
|
+
#keepalive_timeout 0;
|
282
|
+
keepalive_timeout 65;
|
283
|
+
|
284
|
+
#gzip on;
|
285
|
+
|
286
|
+
server {
|
287
|
+
listen 80;
|
288
|
+
server_name localhost;
|
289
|
+
|
290
|
+
#charset koi8-r;
|
291
|
+
|
292
|
+
#access_log logs/host.access.log main;
|
293
|
+
|
294
|
+
location / {
|
295
|
+
root html;
|
296
|
+
index index.html index.htm;
|
297
|
+
}
|
298
|
+
|
299
|
+
#error_page 404 /404.html;
|
300
|
+
|
301
|
+
# redirect server error pages to the static page /50x.html
|
302
|
+
#
|
303
|
+
error_page 500 502 503 504 /50x.html;
|
304
|
+
location = /50x.html {
|
305
|
+
root html;
|
306
|
+
}
|
307
|
+
|
308
|
+
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
309
|
+
#
|
310
|
+
#location ~ \.php$ {
|
311
|
+
# proxy_pass http://127.0.0.1;
|
312
|
+
#}
|
313
|
+
|
314
|
+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
315
|
+
#
|
316
|
+
#location ~ \.php$ {
|
317
|
+
# root html;
|
318
|
+
# fastcgi_pass 127.0.0.1:9000;
|
319
|
+
# fastcgi_index index.php;
|
320
|
+
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
321
|
+
# include fastcgi_params;
|
322
|
+
#}
|
323
|
+
|
324
|
+
# deny access to .htaccess files, if Apache's document root
|
325
|
+
# concurs with nginx's one
|
326
|
+
#
|
327
|
+
#location ~ /\.ht {
|
328
|
+
# deny all;
|
329
|
+
#}
|
330
|
+
}
|
331
|
+
|
332
|
+
}
|
333
|
+
|
334
|
+
|
335
|
+
```
|