nginx wordpress太多重定向

时间:2013-05-08 09:37:46

标签: php wordpress apache nginx

我的服务器环境是linux + nginx + apache + mysql。安装wordpress后出现问题。我可以访问后端,但前端总是显示如下错误:

Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

我转向firefox,错误如下:

301 Moved Permanently

响应:

Reload the page to get source for: http://www.sjdtec.com/

我在我的nginx配置中尝试了很多url重写,但是没有工作,下面是我对nginx和apache的配置:

Nginx的

server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

    root /var/www/sjdtec;
    index index.php index.html index.htm;

    # Make site accessible from http://localhost/
    server_name www.sjdtec.com;

    location / {

            #rewrite ^index\.php$ last;
            try_files $uri $uri/ /index.php?$args;

            #if (!-e $request_filename) {
            #        rewrite ^(.+)/$ /index.php?q=$1 last;
            #}

    }

    location /doc/ {
            alias /usr/share/doc/;
            autoindex on;
            allow 127.0.0.1;
            allow ::1;
            deny all;
    }

    location ~ \.php$ {
            proxy_pass http://127.0.0.1:8080;
    }

    location ~* \.(jpg|jpeg|gif|png|bmp|swf)$ {
            access_log  off;
            expires  30d;
    }

    location ~* \.(js|css)$ {
            access_log  off;
            expires  1d;
    }

    error_page 404 /index.php;

    location ~ /\.ht {
            deny all;
    }

的Apache

<VirtualHost *:8080>
    ServerAdmin webmaster@localhost
    ServerName www.sjdtec.com

    DocumentRoot /var/www/sjdtec
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/sjdtec/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

1 个答案:

答案 0 :(得分:0)

你确定nginx是重写而不是Wordpress吗?例如,如果de wp_options表中的option_name home和/或siturl错误,您也可以获得重定向。