wordpress - Nginx 'rewrite or internal redirection cycle while internally redirecting' resulting in 500 -
i'm having bit of problem nginx 1.2.1-2.2 on raspbian wheezy. think started after changed index thing in sites-available/default file. here relevant files:
nginx.conf user www-data; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { ## # basic settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; index index.html index.htm index.php; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # logging settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # gzip settings ## gzip on; gzip_disable "msie6"; # gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; ## # nginx-naxsi config ## # uncomment if installed nginx-naxsi ## #include /etc/nginx/naxsi_core.rules; ## # nginx-passenger config ## # uncomment if installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby; ## # virtual host configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
sites-available/default server { #listen 80; ## listen ipv4; line default , implied #listen [::]:80 default_server ipv6only=on; ## listen ipv6 root /home/tom/www; index index.html index.htm index.php; # make site accessible http://localhost/ server_name localhost; try_files $uri $uri/ /index.html =404; location / { # first attempt serve request file, # directory, fall displaying 404. try_files $uri $uri/index.html; # uncomment enable naxsi on location # include /etc/nginx/naxsi.rules } location /yourls { # yourls time if (!-e $request_filename){ rewrite ^(.*)$ /yourls-loader.php break; } } # nginx-naxsi used nginx-naxsi-ui : process denied requests #location /requestdenied { # proxy_pass http://127.0.0.1:8080; #} error_page 404 /404.html; # redirect server error pages static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # pass php scripts fastcgi server listening on 127.0.0.1:9000 # location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # note: should have "cgi.fix_pathinfo = 0;" in php.ini # php5-cgi alone: #fastcgi_pass 127.0.0.1:9000; # php5-fpm: fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } }
i getting error when trying access wordpress page, including typing local.dyn.kwl.me/wordpress/ address bar or adding index.php or wp-admin url. in browser displays 500, nginx logs this:
2013/08/19 17:55:49 [error] 31600#0: *58 rewrite or internal redirection cycle while internally redirecting "/wordpress/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html", client: 109.149.13.53, server: localhost, request: "get /wordpress http/1.1", host: "local.dyn.kwl.me" 2013/08/19 17:55:49 [error] 31600#0: *59 rewrite or internal redirection cycle while internally redirecting "/favicon.ico/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html/index.html", client: 109.149.13.53, server: localhost, request: "get /favicon.ico http/1.1", host: "local.dyn.kwl.me"
i'd imagine wrong index or try_files in sites-default file. can see what?
i run wordpress sites on nginx lot. here partial successful config of location directives if can make use of them. nginx version 1.0.15
. might want change fastcgi_pass
param run whatever fastcgi_wrapper running on. maybe fastcgi_pass 127.0.0.1:9000
location @php { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9090; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } if (!-e $request_filename){ rewrite ^(.*)$ /index.php?q=$1 last; break; }
so, in sites config
sites-available/default server { listen 80; ## listen ipv4; line default , implied #listen [::]:80 default_server ipv6only=on; ## listen ipv6 root /home/tom/www; index index.html index.htm index.php; # make site accessible http://localhost/ server_name localhost; # nginx-naxsi used nginx-naxsi-ui : process denied requests #location /requestdenied { # proxy_pass http://127.0.0.1:8080; #} error_page 404 /404.html; # redirect server error pages static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # pass php scripts fastcgi server listening on 127.0.0.1:9000 ## original config # location ~ \.php$ { # fastcgi_split_path_info ^(.+\.php)(/.+)$; # note: should have "cgi.fix_pathinfo = 0;" in php.ini # php5-cgi alone: # fastcgi_pass 127.0.0.1:9000; # php5-fpm: # fastcgi_pass unix:/var/run/php5-fpm.sock; # fastcgi_index index.php; # include fastcgi_params; # } ## new config location @php { ## depending on nginx version, might need change location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9090; ## maybe change 9000 or use socket fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param script_filename $document_root$fastcgi_script_name; fastcgi_intercept_errors on; } ## wordpress rewrite if (!-e $request_filename){ rewrite ^(.*)$ /index.php?q=$1 last; break; } }
edit
based on last comment me. if dns doesn't resolve sub directory /wordpress/ must change rewrite rule.
## wordpress rewrite if (!-e $request_filename){ rewrite ^(.*)$ /wordpress/index.php?q=$1 last; break; }
Comments
Post a Comment