内部重定向到“/index.php”

时间:2016-09-15 07:10:19

标签: wordpress nginx easy-digital-downloads

我正在使用带有软件许可插件的EDD。当我尝试发布新版本时,我的客户端可以选择从Wordpress网站更新主题。每当他们尝试更新主题时,我都会在error.log中收到此错误。

2016/09/14 08:22:45 [error] 18939#0: *92285 rewrite or internal redirection cycle while internally redirecting to "/index.php"
client: 5.61.30.19
server: domain.com
request: "GET /edd-sl/package_download/jibberish HTTP/1.1"
upstream: "fastcgi://unix:/run/php5-fpm.sock"
host: "domain.com"
referrer: "https://domain.com/edd-sl/package_download/jibberish"

我正在使用nginx服务器。这是它的配置。

位点可用/ domain.com

# WPSINGLE WP SUPER CACHE NGINX CONFIGURATION

server {
listen 80;

server_name domain.com www.domain.com;

return 301 https://$server_name$request_uri;
}

server {
listen 443 ssl;

server_name domain.com www.domain.com;

ssl       on;
ssl_protocols TLSv1.1 TLSv1.2;

ssl_certificate       /srv/ssl/domain.com.crt;
ssl_certificate_key   /srv/ssl/domain.com.key;

access_log   /srv/www/domain.com/logs/access.log;
error_log    /srv/www/domain.com/logs/error.log;

root /srv/www/domain.com/htdocs;
index index.php index.htm index.html;

include common/wpsc.conf;
include common/wpcommon.conf;
include common/locations.conf;
}

公共/ wpsc.conf

# WPSC NGINX CONFIGURATION

set $cache_uri $request_uri;

# POST requests and URL with a query string should always go to php
if ($request_method = POST) {
set $cache_uri 'null cache';
}

if ($query_string != "") {
set $cache_uri 'null cache';
}

# Don't cache URL containing the following segments
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") {
set $cache_uri 'null cache';
}

# Don't use the cache for logged in users or recent commenter
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") {
set $cache_uri 'null cache';
}

# Use cached or actual file if they exists, Otherwise pass request to WordPress
location / {
try_files /wp-content/cache/supercache/$http_host/$scheme$cache_uri/index.html $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass php;

# Following line is needed by WP Super Cache plugin
fastcgi_param SERVER_NAME $http_host;
}

公共/ wpcommon.conf

# WordPress COMMON SETTINGS

# Limit access to avoid brute force attack
location = /wp-login.php {
limit_req zone=one burst=1 nodelay;
include fastcgi.conf;
fastcgi_pass php;
}

# Disable wp-config.txt
location = /wp-config.txt {
deny  all;
access_log off;
log_not_found off;
}

# Disallow php in upload folder
location /wp-content/uploads/ {
location ~ ^/wp-content/uploads/edd/(.*?)\.zip$ {
rewrite / permanent;
}

location ~ \.php$ {
#Prevent Direct Access Of PHP Files From Web Browsers
deny all;
}
}

# Yoast sitemap
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;

# Rules for yoast sitemap with wp|wpsubdir|wpsubdomain 
rewrite ^.*/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^.*/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

# Following lines are options. Needed for WordPress seo addons
rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last;
rewrite ^/locations\.kml$ /index.php?sitemap=wpseo_local_kml last;
rewrite ^/geo_sitemap\.xml$ /index.php?sitemap=wpseo_local last;
rewrite ^/video-sitemap\.xsl$ /index.php?xsl=video last;

access_log off;
}

公共/ locations.conf

# NGINX CONFIGURATION FOR COMMON LOCATION

# Basic locations files
location = /favicon.ico {
access_log off;
log_not_found off;
expires max;
}

location = /robots.txt {
# Some WordPress plugin gererate robots.txt file
# Refer #340 issue
try_files $uri $uri/ /index.php?$args;
access_log off;
log_not_found off;
}

# Cache static files
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ {
add_header "Access-Control-Allow-Origin" "*";
access_log off;
log_not_found off;
expires max;
}


# Security settings for better privacy

# Deny hidden files
location ~ /\. {
deny  all;
access_log off;
log_not_found off;
}

# Deny backup extensions & log files
location ~* ^.+\.(bak|log|old|orig|original|php#|php~|php_bak|save|swo|swp|sql)$ {
deny  all;
access_log off;
log_not_found off;
}
# Return 403 forbidden for readme.(txt|html) or license.(txt|html)
if ($request_uri ~* "^.+(readme|license)\.(txt|html)$") {
return 403;
}

fastcgi.conf

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

0 个答案:

没有答案