質問編集履歴

2

追記

2017/10/19 17:53

投稿

ruby_0ct
ruby_0ct

スコア57

test CHANGED
File without changes
test CHANGED
@@ -85,3 +85,331 @@
85
85
  }
86
86
 
87
87
  ```
88
+
89
+
90
+
91
+ ###追記1 02:53
92
+
93
+ **ay03さん**
94
+
95
+ ご回答ありがとうございます。
96
+
97
+ とりあえず参考にしながら修正してみたところエラー表示が変わり、File not found.となりました。
98
+
99
+
100
+
101
+ サーバ側は、単にアドレス通りにディレクトリを読んでいるのでこのエラーに変わったんだと思いますが、原因はnginx.confの設定に間違いないと思います。
102
+
103
+
104
+
105
+ WordPressは、作成したサイトのブログページ部分のみに導入しているので、バーチャルホストを利用して設定しています。
106
+
107
+
108
+
109
+ 一応、nginx.conf全文を載せておきます。
110
+
111
+
112
+
113
+
114
+
115
+ ```
116
+
117
+ user nginx;
118
+
119
+ worker_processes 1;
120
+
121
+
122
+
123
+ error_log /var/log/nginx/error.log warn;
124
+
125
+ pid /var/run/nginx.pid;
126
+
127
+
128
+
129
+
130
+
131
+ events {
132
+
133
+ worker_connections 1024;
134
+
135
+ }
136
+
137
+
138
+
139
+
140
+
141
+ http {
142
+
143
+ include /etc/nginx/mime.types;
144
+
145
+ default_type application/octet-stream;
146
+
147
+
148
+
149
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
150
+
151
+ '$status $body_bytes_sent "$http_referer" '
152
+
153
+ '"$http_user_agent" "$http_x_forwarded_for"';
154
+
155
+
156
+
157
+ access_log /var/log/nginx/access.log main;
158
+
159
+
160
+
161
+ sendfile on;
162
+
163
+
164
+
165
+ keepalive_timeout 65;
166
+
167
+
168
+
169
+ server {
170
+
171
+ listen 80;
172
+
173
+ server_name ドメイン名;
174
+
175
+ return 301 https://ドメイン名$request_uri;
176
+
177
+ }
178
+
179
+
180
+
181
+ server {
182
+
183
+ listen 443 ssl;
184
+
185
+ server_name ドメイン名;
186
+
187
+
188
+
189
+ ssl_certificate ***;
190
+
191
+ ssl_certificate_key ***;
192
+
193
+
194
+
195
+ charset UTF-8;
196
+
197
+
198
+
199
+ location / {
200
+
201
+ try_files $uri $uri/ /index.php?$query_string;
202
+
203
+ root /var/www/html;
204
+
205
+ index index.html index.html index.php;
206
+
207
+ if ( -f $request_filename ) {
208
+
209
+ expires 30d;
210
+
211
+ break;
212
+
213
+ }
214
+
215
+ if (!-e $request_filename) {
216
+
217
+ rewrite ^.+?(/.*.php)$ $1 last;
218
+
219
+ rewrite ^ /index.php last;
220
+
221
+ }
222
+
223
+ }
224
+
225
+
226
+
227
+ error_page 500 502 503 504 /50x.html;
228
+
229
+ location = /50x.html {
230
+
231
+ root /usr/share/nginx/html;
232
+
233
+ }
234
+
235
+
236
+
237
+
238
+
239
+ location ~ .php$ {
240
+
241
+ root /var/www/html;
242
+
243
+ fastcgi_pass 127.0.0.1:9000;
244
+
245
+ fastcgi_index index.php;
246
+
247
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
248
+
249
+ include fastcgi_params;
250
+
251
+ }
252
+
253
+ }
254
+
255
+
256
+
257
+ # ブログ
258
+
259
+ server {
260
+
261
+ listen 80;
262
+
263
+ server_name ドメイン名/blog;
264
+
265
+ return 301 https://ドメイン名/blog$request_uri;
266
+
267
+ }
268
+
269
+
270
+
271
+ server {
272
+
273
+ listen 443 ssl;
274
+
275
+ server_name ドメイン名/blog;
276
+
277
+
278
+
279
+ ssl_certificate ***;
280
+
281
+ ssl_certificate_key ***;
282
+
283
+
284
+
285
+ access_log /var/log/nginx/blog.access.log main;
286
+
287
+
288
+
289
+ location / {
290
+
291
+ root /var/www/html/blog;
292
+
293
+ index index.html index.htm index.php;
294
+
295
+ try_files $uri $uri/ /index.php?$query_string;
296
+
297
+
298
+
299
+ if ( -f $request_filename ) {
300
+
301
+ expires 30d;
302
+
303
+ break;
304
+
305
+ }
306
+
307
+ if (!-e $request_filename) {
308
+
309
+ rewrite ^.+?(/.*.php)$ $1 last;
310
+
311
+ rewrite ^ /index.php last;
312
+
313
+ }
314
+
315
+ }
316
+
317
+
318
+
319
+ location ~ .php$ {
320
+
321
+ root /var/www/html/blog;
322
+
323
+ fastcgi_split_path_info ^(.+.php)(/.+)$;
324
+
325
+ fastcgi_pass unix:/var/run/php-fpm.sock;
326
+
327
+ fastcgi_index index.php;
328
+
329
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
330
+
331
+ fastcgi_param PATH_INFO $fastcgi_path_info;
332
+
333
+ include fastcgi_params;
334
+
335
+ fastcgi_read_timeout 300;
336
+
337
+ }
338
+
339
+
340
+
341
+ location ~* ^.+.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
342
+
343
+ access_log off; log_not_found off; expires max;
344
+
345
+ }
346
+
347
+
348
+
349
+ location ~ .php$ {
350
+
351
+ try_files $uri =404;
352
+
353
+ fastcgi_split_path_info ^(.+.php)(.*)$;
354
+
355
+ fastcgi_pass unix:/var/run/php-fpm.sock;
356
+
357
+ fastcgi_index index.php;
358
+
359
+ include /etc/nginx/fastcgi_params;
360
+
361
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
362
+
363
+ fastcgi_param PAHT_INFO $fastcgi_script_name;
364
+
365
+ fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
366
+
367
+ }
368
+
369
+
370
+
371
+ location ^~ /phpmyadmin {
372
+
373
+ alias /var/www/phpmyadmin;
374
+
375
+ index index.php index.html;
376
+
377
+ location ~ ^/phpmyadmin/(.+.php)$ {
378
+
379
+ alias /var/www/phpmyadmin/$1;
380
+
381
+ fastcgi_index index.php;
382
+
383
+ fastcgi_pass unix:/var/run/php-fpm.sock;
384
+
385
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
386
+
387
+ include fastcgi_params;
388
+
389
+ }
390
+
391
+ }
392
+
393
+
394
+
395
+ # WordPressの設定
396
+
397
+ location @wordpress {
398
+
399
+ fastcgi_index index.php;
400
+
401
+ fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
402
+
403
+ fastcgi_param SCRIPT_FILENAME /var/www/html/blog/index.php;
404
+
405
+ include fastcgi_params;
406
+
407
+ }
408
+
409
+ }
410
+
411
+ }
412
+
413
+
414
+
415
+ ```

1

修正

2017/10/19 17:53

投稿

ruby_0ct
ruby_0ct

スコア57

test CHANGED
@@ -1 +1 @@
1
- Nginx WordPressのパーマリンク設定をしたい
1
+ Nginx WordPressのパーマリンク設定でエラー
test CHANGED
File without changes