はじめまして
現在wordpressにてブログを運用しており
キャッシュを活用しサイト表示の高速化をしようと試みております。
を参考にnginxの設定をしてみたところ
サイトにアクセスすると下記の phpファイルのダウンロードが始まり
サイト自体にアクセスができなくなってしまいました。
間違いがあったら、ヒントだけでもいいので指摘していただきたいです。
■ 環境
sakura vps
PHP-fpm
nginx
mysql
ubuntu 14.04
###ダウンロードが始まるPHPファイル
lang
1<?php 2/** 3 * Front to the WordPress application. This file doesn't do anything, but loads 4 * wp-blog-header.php which does and tells WordPress to load the theme. 5 * 6 * @package WordPress 7 */ 8 9/** 10 * Tells WordPress to load the WordPress theme and output it. 11 * 12 * @var bool 13 */ 14define('WP_USE_THEMES', true); 15 16/** Loads the WordPress Environment and Template */ 17require( dirname( __FILE__ ) . '/wp-blog-header.php' );
###nginx.confファイル
lang
1user nginx; 2worker_processes 4; 3pid /run/nginx.pid; 4 5events { 6 worker_connections 2048; 7 multi_accept on; 8} 9 10http { 11 include /etc/nginx/mime.types; 12 default_type application/octet-stream; 13 client_max_body_size 50m; 14 15 access_log /var/log/nginx/access.log; 16 error_log /var/log/nginx/error.log; 17 18 gzip on; 19 gzip_disable "msie6"; 20 21 #include /etc/nginx/naxsi_core.rules; 22 23 include /etc/nginx/conf.d/*.conf; 24 include /etc/nginx/sites-enabled/*; 25 26 fastcgi_cache_path /var/log/nginx/cache levels=1:2 keys_zone=wpcache:10m max_size=50M inactive=30m; 27 proxy_temp_path /var/tmp/nginx; 28 proxy_cache_key "$scheme://$host$request_uri"; 29 proxy_set_header Host $host; 30 proxy_set_header X-Real-IP $remote_addr; 31 proxy_set_header X-Forwarded-Host $host; 32 proxy_set_header X-Forwarded-Server $host; 33 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 34}
###wordpress.conf
lang
1server { 2 listen 80; 3 server_name wordpress.com; 4 root /var/www/wordpress.com/; 5 index index.html index.php; 6 access_log /var/log/nginx/wordpress.com.access.log; 7 error_log /var/log/nginx/wordpress.error.log; 8 9 set $mobile ""; 10 if ($http_user_agent ~* '(DoCoMo|J-PHONE|Vodafone|MOT-|UP¥.Browser|DDIPOCKET|ASTEL|PDXGW|Palmscape|Xiino|sharp pda browser|Windows CE|L-mode|WILLCOM|Softbank|Semulator|Vemulator|J-EMULATOR|emobile|mixi-mobile-converter)') { 11 set $mobile ".ktai"; 12 } 13 if ($http_user_agent ~* '(iPhone|iPod|Opera Mini|Android.*Mobile|NetFront|PSP|3DS|BlackBerry|Windows Phone)') { 14 set $mobile ".smartphone"; 15 } 16 17 location ~ .*¥.(txt|xml|html?|js|css|gz|ico|jpe?g|gif|png|wmv|flv|mpg) { 18 access_log off; 19 expires 30d; 20 break; 21 } 22 23 location ~ /¥.ht { 24 deny all; 25 } 26 27 location /wp-admin { 28 proxy_pass http://backend; 29 } 30 31 location / { 32 if ($http_cookie ~* "comment_author_|wordpress_(?!test_coolie)|wp-postpass_" ) { 33 set $do_not_cache 1; 34 } 35 proxy_no_cache $do_not_cache; 36 proxy_cache_bypass $do_not_cache; 37 38 proxy_cache_key "$scheme://$host$request_uri$is_args$args$mobile"; 39 proxy_cache_valid 200 10m; 40 proxy_cache_valid 404 5m; 41 proxy_pass http://backend; 42 } 43} #80server 44 45upstream backend{ 46 server 127.0.0.1:8080; 47} 48 49server { 50 listen 8080; 51 server_name _; 52 index index.html index.htm index.php; 53 54 gzip off; 55 gzip_vary off; 56 57 location / { 58 index index.php index.html index.htm; 59 # static files 60 if (-f $request_filename) { 61 access_log off; 62 break; 63 } 64 # request to index.php 65 if (!-e $request_filename) { 66 rewrite ^(.+)$ /index.php?q=$1 last; 67 } 68 } # 8080location 69 location ~ ¥.php$ { 70 fastcgi_pass 127.0.0.1:9000; 71 fastcgi_index index.php; 72 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 73 include fastcgi_params; 74 } 75} #sever 8080
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/11/11 17:49
2015/11/12 02:31
2015/11/12 08:22