简体   繁体   English

nginx wordpress重定向过多

[英]nginx wordpress too many redirects

My server environment is linux + nginx + apache + mysql. 我的服务器环境是linux + nginx + apache + mysql。 And there is a problem after I install wordpress. 安装wordpress后出现问题。 I can access the backend, but the frontend alway show error as below: 我可以访问后端,但是前端始终显示错误,如下所示:

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

I turn to firefox and the error as below: 我转向firefox,错误如下:

301 Moved Permanently

response: 响应:

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

I try many url rewrite in my nginx config, but not working, below are my config for nginx and apache: 我在我的nginx配置中尝试了许多url重写,但是没有用,以下是我的nginx和apache配置:

Nginx 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>

Are you sure that nginx is rewriting and not Wordpress? 您确定nginx正在重写而不是Wordpress吗? For example, if option_name home and/or siturl are wrong in de wp_options table, you als can get redirects. 例如,如果de wp_options表中的option_name home和/或siturl错误,则可以获取重定向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM