質問編集履歴

1

追記した

2016/07/26 05:00

投稿

ryuujinn
ryuujinn

スコア72

test CHANGED
File without changes
test CHANGED
@@ -67,3 +67,253 @@
67
67
 
68
68
 
69
69
  データベースの変更などをしなくてすむので、レイアウト崩れや画像の欠落などもないのではないかと思います
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ 以下のサイトを見つけたのですが、自分のexample.confにどのように追記したらいいのか迷っています
78
+
79
+
80
+
81
+ http://owani.net/wordpress/subdirectory/445/
82
+
83
+
84
+
85
+ ```
86
+
87
+ server {
88
+
89
+ listen 80;
90
+
91
+ server_name owani.net;
92
+
93
+ root /var/www/html;
94
+
95
+
96
+
97
+ location / {
98
+
99
+ try_files $uri $uri/ index.html index.php;
100
+
101
+ }
102
+
103
+
104
+
105
+ location @wp {
106
+
107
+ rewrite ^/blog(.*) /blog/index.php?q=$1;
108
+
109
+ }
110
+
111
+ location ^~ /blog {
112
+
113
+ root /var/www/html;
114
+
115
+ index index.php index.html index.htm;
116
+
117
+ try_files $uri $uri/ @wp;
118
+
119
+
120
+
121
+ location ~ \.php$ {
122
+
123
+ include fastcgi_params;
124
+
125
+ fastcgi_param SCRIPT_FILENAME $request_filename;
126
+
127
+ fastcgi_pass 127.0.0.1:9000;
128
+
129
+ }
130
+
131
+ }
132
+
133
+ }
134
+
135
+ ```
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+ 以下の部分を追記したのですが、上手く反映されませんでした
144
+
145
+
146
+
147
+ ```
148
+
149
+
150
+
151
+ # wordpressをサブディレクトリにインストールする方法
152
+
153
+
154
+
155
+ location @wp {
156
+
157
+ rewrite ^/wordpress(.*) /wordpress/index.php?q=$1;
158
+
159
+ }
160
+
161
+ location ^~ /wordpress {
162
+
163
+ root /usr/share/nginx/example/wordpress;
164
+
165
+ index index.php index.html index.htm;
166
+
167
+ try_files $uri $uri/ @wp;
168
+
169
+
170
+
171
+ location ~ \.php$ {
172
+
173
+ include fastcgi_params;
174
+
175
+ fastcgi_param SCRIPT_FILENAME $request_filename;
176
+
177
+ fastcgi_pass 127.0.0.1:9000;
178
+
179
+ }
180
+
181
+
182
+
183
+ }
184
+
185
+
186
+
187
+ ```
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+ 以下が自分の設定しているexample.conf
196
+
197
+
198
+
199
+
200
+
201
+ ```
202
+
203
+ server {
204
+
205
+ listen 80;
206
+
207
+ server_name www.example;
208
+
209
+ root /usr/share/nginx/example/wordpress;
210
+
211
+ index index.php;
212
+
213
+
214
+
215
+ charset utf-8;
216
+
217
+
218
+
219
+ # wordpress パーマネントリンク設定
220
+
221
+ try_files $uri $uri/ /index.php?q=$uri&$args;
222
+
223
+
224
+
225
+ # wp-config.phpへのアクセス拒否設定
226
+
227
+ location ~* /wp-config.php {
228
+
229
+ deny all;
230
+
231
+ }
232
+
233
+
234
+
235
+ # php-fpm用設定
236
+
237
+ location ~ \.php$ {
238
+
239
+ fastcgi_pass 127.0.0.1:9000;
240
+
241
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
242
+
243
+ fastcgi_param PATH_INFO $fastcgi_script_name;
244
+
245
+ include fastcgi_params;
246
+
247
+ }
248
+
249
+
250
+
251
+ # phpMyAdmin settings
252
+
253
+ location /phpMyAdmin {
254
+
255
+ alias /usr/share/phpMyAdmin/;
256
+
257
+ index index.php;
258
+
259
+ location ~ ^/phpMyAdmin/(.+\.php)$ {
260
+
261
+ alias /usr/share/phpMyAdmin;
262
+
263
+ fastcgi_pass 127.0.0.1:9000;
264
+
265
+ fastcgi_index index.php;
266
+
267
+ fastcgi_param SCRIPT_FILENAME /usr/share/phpMyAdmin/$1;
268
+
269
+ fastcgi_param PATH_INFO $fastcgi_script_name;
270
+
271
+ include fastcgi_params;
272
+
273
+ }
274
+
275
+ }
276
+
277
+
278
+
279
+ # wordpressをサブディレクトリにインストールする方法
280
+
281
+
282
+
283
+ location @wp {
284
+
285
+ rewrite ^/wordpress(.*) /wordpress/index.php?q=$1;
286
+
287
+ }
288
+
289
+ location ^~ /wordpress {
290
+
291
+ root /usr/share/nginx/example/wordpress;
292
+
293
+ index index.php index.html index.htm;
294
+
295
+ try_files $uri $uri/ @wp;
296
+
297
+
298
+
299
+ location ~ \.php$ {
300
+
301
+ include fastcgi_params;
302
+
303
+ fastcgi_param SCRIPT_FILENAME $request_filename;
304
+
305
+ fastcgi_pass 127.0.0.1:9000;
306
+
307
+ }
308
+
309
+
310
+
311
+ }
312
+
313
+
314
+
315
+
316
+
317
+ }
318
+
319
+ ```