【前提】
EC2のインスタンス上にnginxをインストールし、その上でWordPressを立ち上げようとしています。
【問題】
現状ブラウザ(chrome)でURLを入力するとPHPファイルがダウンロードされてしまいます。
e.g. http://mydomain/wordpressと入力
→ wordpressのindex.phpファイルが解析されてhtmlが描画されてほしいが
index.phpファイルがダウンロードされてしまう。
【調査した内容】
・php−fmpがport:9000でlistenなのは確認済みです。
・FireFoxで同じURLを叩くと403エラーが表示されます。
・/etc/php-fpm.d/www.confでuser及びgroupをapacheからnginxへ変更済みです。
以上になりますので、よろしくお願い致します。
以下がnginx.conファイルです。
For more information on configuration, see:
* Official English Documentation: http://nginx.org/en/docs/
* Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf; index index.html index.htme servet_timeは処理時間(ms) log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" $request_time'; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 10; connection_pool_size 256; client_header_buffer_size 1k; large_client_header_buffers 4 2k; request_pool_size 4k; if_modified_since before; ignore_invalid_headers on; server_tokens off; gzip on; gzip_min_length 0; gzip_buffers 4 8k; gzip_types text/plain text/xml application/x-javascript text/css; gzip_disable "msie6"; gzip_vary on; # HttpStaticGzipModuleをオンに gzip_static on; output_buffers 1 32k; postpone_output 1460; # fastcgi cacheの設定(httpディレクティブ内のみ有効) fastcgi_cache_path /usr/local/nginx/cache levels=1:2 keys_zone=wpcache:10m max_size=50M inactive=30m; server{ listen 80; server_name localhost; root /usr/share/nginx/html; #auth_basic "basic authentication"; #auth_basic_user_file "/usr/share/nginx/html/.htpasswd"; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm index.php; } location /wordpress { root /usr/share/nginx/html/wordpress/; index index.php; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/wordpress$fastcgi_script_name; fastcgi_intercept_errors on; include fastcgi_params; if (!-e $request_filename) { rewrite ^/wordpress(.+)$ /blog/index.php?q=$1 last; break; } } location ~ ^/wordpress/.+.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^/wordpress(.+.php)(.*)$; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/wordpress$fastcgi_script_name; fastcgi_intercept_errors on; include fastcgi_params; } # redirect server error pages to the static page /40x.html # error_page 404 /404.html; location = /40x.html { } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # # location ~ .php$ { # root /usr/share/nginx/html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME usr/share/nginx/html$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ (.ht|.git|.svn) { deny all; } }
å
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。