我的服务器环境是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;
}
阿帕奇
<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>