質問編集履歴

2

\*\.confのファイル

2017/09/05 08:35

投稿

ByronHasegawa
ByronHasegawa

スコア255

test CHANGED
File without changes
test CHANGED
@@ -157,3 +157,307 @@
157
157
  }
158
158
 
159
159
  ```
160
+
161
+
162
+
163
+ ###*.confのファイル
164
+
165
+ ```ここに言語を入力
166
+
167
+ #=======================================
168
+
169
+ # xn--testtesttest.com SSL
170
+
171
+ #---------------------------------------
172
+
173
+
174
+
175
+ server {
176
+
177
+ listen 443 ssl http2;
178
+
179
+ server_name xn--testtesttest.com www.xn--testtesttest.com;
180
+
181
+
182
+
183
+ ssl_certificate /etc/letsencrypt/live/xn--testtesttest.com/fullchain.pem;
184
+
185
+ ssl_certificate_key /etc/letsencrypt/live/xn--testtesttest.com/privkey.pem;
186
+
187
+ ssl_dhparam /etc/kusanagi.d/ssl/dhparam.key;
188
+
189
+
190
+
191
+ ssl_session_tickets on;
192
+
193
+ ssl_session_ticket_key /etc/kusanagi.d/ssl_sess_ticket.key;
194
+
195
+
196
+
197
+ ssl_session_cache shared:SSL:1m;
198
+
199
+ ssl_session_timeout 5m;
200
+
201
+
202
+
203
+ #ssl_ct on;
204
+
205
+ #ssl_ct_static_scts /etc/pki/tls/certs/scts;
206
+
207
+
208
+
209
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
210
+
211
+
212
+
213
+ ssl_prefer_server_ciphers on;
214
+
215
+
216
+
217
+ ## OCSP stapling
218
+
219
+ #ssl_stapling on;
220
+
221
+ #ssl_stapling_verify on;
222
+
223
+ #resolver 8.8.4.4 8.8.8.8 valid=300s;
224
+
225
+ #resolver_timeout 10s;
226
+
227
+
228
+
229
+ access_log /home/kusanagi/testtesttest/log/nginx/ssl_access.log main;
230
+
231
+ error_log /home/kusanagi/testtesttest/log/nginx/ssl_error.log warn;
232
+
233
+
234
+
235
+ charset UTF-8;
236
+
237
+ client_max_body_size 16M;
238
+
239
+ root /home/kusanagi/testtesttest/DocumentRoot;
240
+
241
+ index index.php index.html index.htm;
242
+
243
+ rewrite /wp-admin$ $scheme://$host$uri/ permanent;
244
+
245
+
246
+
247
+ location / {
248
+
249
+ try_files $uri $uri/ /index.php?$args;
250
+
251
+ }
252
+
253
+
254
+
255
+ location = /favicon.ico {
256
+
257
+ log_not_found off;
258
+
259
+ access_log off;
260
+
261
+ }
262
+
263
+
264
+
265
+ location ~* /.well-known {
266
+
267
+ allow all;
268
+
269
+ }
270
+
271
+
272
+
273
+ location ~* /. {
274
+
275
+ deny all;
276
+
277
+ }
278
+
279
+
280
+
281
+ location ~* /(?:uploads|files)/.*.php$ {
282
+
283
+ deny all;
284
+
285
+ }
286
+
287
+
288
+
289
+ #include templates.d/multisite.conf;
290
+
291
+
292
+
293
+ location ~* .(jpg|jpeg|gif|png|css|js|swf|ico|pdf|svg|eot|ttf|woff)$ {
294
+
295
+ access_log off;
296
+
297
+ }
298
+
299
+
300
+
301
+ location ~* /wp-login.php|/wp-admin/((?!admin-ajax.php).)*$ {
302
+
303
+ satisfy any;
304
+
305
+ allow 153.168.29.119;
306
+
307
+ allow 127.0.0.1;
308
+
309
+ deny all;
310
+
311
+ auth_basic "basic authentication";
312
+
313
+ auth_basic_user_file "/home/kusanagi/.htpasswd";
314
+
315
+ location ~ [^/].php(/|$) {
316
+
317
+ fastcgi_split_path_info ^(.+?.php)(/.*)$;
318
+
319
+ if (!-f $document_root$fastcgi_script_name) {
320
+
321
+ return 404;
322
+
323
+ }
324
+
325
+ fastcgi_pass 127.0.0.1:9000;
326
+
327
+ fastcgi_index index.php;
328
+
329
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
330
+
331
+ include fastcgi_params;
332
+
333
+ fastcgi_buffers 256 128k;
334
+
335
+ fastcgi_buffer_size 128k;
336
+
337
+ fastcgi_intercept_errors on;
338
+
339
+ fastcgi_read_timeout 120s;
340
+
341
+ }
342
+
343
+ }
344
+
345
+
346
+
347
+ location ~ [^/].php(/|$) {
348
+
349
+ fastcgi_split_path_info ^(.+?.php)(/.*)$;
350
+
351
+ if (!-f $document_root$fastcgi_script_name) {
352
+
353
+ return 404;
354
+
355
+ }
356
+
357
+ fastcgi_pass 127.0.0.1:9000;
358
+
359
+ fastcgi_index index.php;
360
+
361
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
362
+
363
+ include fastcgi_params;
364
+
365
+ fastcgi_buffers 256 128k;
366
+
367
+ fastcgi_buffer_size 128k;
368
+
369
+ fastcgi_intercept_errors on;
370
+
371
+ fastcgi_read_timeout 120s;
372
+
373
+ #add_header Strict-Transport-Security "max-age=31536000";
374
+
375
+
376
+
377
+ set $do_not_cache 0; ## page cache
378
+
379
+ set $device "pc";
380
+
381
+
382
+
383
+ if ($request_method = POST) {
384
+
385
+ set $do_not_cache 1;
386
+
387
+ }
388
+
389
+
390
+
391
+ if ($query_string != "") {
392
+
393
+ set $do_not_cache 1;
394
+
395
+ }
396
+
397
+
398
+
399
+ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
400
+
401
+ set $do_not_cache 1;
402
+
403
+ }
404
+
405
+
406
+
407
+ if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
408
+
409
+ set $do_not_cache 1;
410
+
411
+ }
412
+
413
+
414
+
415
+ if ($http_user_agent ~* " Android |(iPad|Android; Tablet; .+Firefox") {
416
+
417
+ set $device "tablet";
418
+
419
+ }
420
+
421
+
422
+
423
+ if ($http_user_agent ~* " Android .+ Mobile |(iPhone|(iPod|IEMobile|Android; Mobile; .+Firefox|Windows Phone") {
424
+
425
+ set $device "smart";
426
+
427
+ }
428
+
429
+
430
+
431
+ fastcgi_cache wpcache;
432
+
433
+ fastcgi_cache_key "$device:$request_method:$scheme://$host$request_uri";
434
+
435
+ fastcgi_cache_valid 200 10m;
436
+
437
+ fastcgi_no_cache $do_not_cache;
438
+
439
+ fastcgi_cache_bypass $do_not_cache;
440
+
441
+
442
+
443
+ add_header X-F-Cache $upstream_cache_status;
444
+
445
+ add_header X-Signature KUSANAGI;
446
+
447
+ }
448
+
449
+
450
+
451
+ location ~ /fcache-purge/([^/]+)(/.*) {
452
+
453
+ allow 127.0.0.1;
454
+
455
+ deny all;
456
+
457
+ fastcgi_cache_purge wpcache "$1:GET:$scheme://$host$2";
458
+
459
+ }
460
+
461
+ }
462
+
463
+ ```

1

nginx設定ファイル追加

2017/09/05 08:34

投稿

ByronHasegawa
ByronHasegawa

スコア255

test CHANGED
File without changes
test CHANGED
@@ -31,3 +31,129 @@
31
31
 
32
32
 
33
33
  phpのバージョンは5.6.31で、nginxで動いています。
34
+
35
+
36
+
37
+ ###nginx設定ファイル
38
+
39
+ ```ここに言語を入力
40
+
41
+ user httpd www;
42
+
43
+ worker_processes auto;
44
+
45
+ worker_rlimit_nofile 20000;
46
+
47
+
48
+
49
+
50
+
51
+ error_log /var/log/nginx/error.log warn;
52
+
53
+ pid /var/run/nginx.pid;
54
+
55
+
56
+
57
+ events {
58
+
59
+ worker_connections 4096;
60
+
61
+ multi_accept on;
62
+
63
+ use epoll;
64
+
65
+ }
66
+
67
+
68
+
69
+ http {
70
+
71
+ server_tokens off;
72
+
73
+ include /etc/nginx/mime.types;
74
+
75
+ default_type application/octet-stream;
76
+
77
+ charset UTF-8;
78
+
79
+ server_names_hash_bucket_size 128;
80
+
81
+
82
+
83
+ log_format main '$request_time $sent_http_x_f_cache $sent_http_x_b_cache '
84
+
85
+ '$remote_addr - $remote_user [$time_local] "$request" '
86
+
87
+ '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
88
+
89
+
90
+
91
+ access_log /var/log/nginx/access.log main;
92
+
93
+ client_max_body_size 20M;
94
+
95
+ client_body_buffer_size 768k;
96
+
97
+ sendfile on;
98
+
99
+ tcp_nopush on;
100
+
101
+ tcp_nodelay on;
102
+
103
+ keepalive_timeout 5;
104
+
105
+ connection_pool_size 1024;
106
+
107
+ request_pool_size 8k;
108
+
109
+
110
+
111
+ gzip on;
112
+
113
+ gzip_http_version 1.0;
114
+
115
+ gzip_disable "msie6";
116
+
117
+ gzip_proxied any;
118
+
119
+ gzip_min_length 1024;
120
+
121
+ gzip_comp_level 2;
122
+
123
+ gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/json;
124
+
125
+
126
+
127
+ brotli on;
128
+
129
+ brotli_static on;
130
+
131
+ brotli_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/json;
132
+
133
+ brotli_comp_level 3;
134
+
135
+ brotli_min_length 1024;
136
+
137
+
138
+
139
+ open_file_cache max=100000 inactive=20s;
140
+
141
+ open_file_cache_valid 30s;
142
+
143
+ open_file_cache_min_uses 2;
144
+
145
+ open_file_cache_errors on;
146
+
147
+ fastcgi_cache_path /var/cache/nginx/wordpress levels=1:2 keys_zone=wpcache:30m max_size=512M inactive=600m;
148
+
149
+ fastcgi_ignore_headers "Vary" "Cache-Control" "Expires";
150
+
151
+
152
+
153
+ include /etc/nginx/conf.d/*.conf;
154
+
155
+
156
+
157
+ }
158
+
159
+ ```