我正在将一个WordPress的博客从一个基于Apache的networking服务器转移到一个基于Nginx的networking服务器 。 简单的步骤,我想:
来源WordPress文件夹的scp(在本例中为/var/www/example.com),该文件被传输到远程Web服务器上的同名文件夹。 没问题。
源WordPress数据库的mysqldump。 没问题。
在nginxnetworking服务器上,我创build了一个数据库(与源数据库名称相同,只是为了保持一切)。
我设置了一个默认的WP博客,看看现在是否一切正常。 我创造一个适当的
/etc/nginx/sites-available/example.comconfiguration文件(当然还有链接到启用网站的链接)。 那
configuration文件指向一个不同的文件夹(/ var / www / exampletemp)
修改我的Windows主机文件,以testing我感兴趣的域上的新博客。example.com的博客显示罚款,当然默认WP博客,但有正确的URL。
然后是关键的步骤。 首先,我编辑/etc/nginx/sites-available/example.com,以便现在指向真正的备份文件夹(/var/www/example.com) – >(只需更改根位置和fastcgi指令)。
然后我创build另一个数据库,恢复这个新的源数据库,编辑/ var /
我能得到什么?
一个华丽,美丽的 “错误310:太多redirect”:(
我可以在www.example.com/wp-login.php上看到login页面,但是我的源用户不工作,我无法访问WordPress仪表板。 我已经从phpMyadmin修改了一个pipe理员帐号,设置了一个新的密码,并select了MD5encryption,尽pipe当我从Apache转移到Apache或Nginx到Nginx时,这个工作起作用了。
我真的不明白为什么有太多的redirect错误。 我尝试禁用所有插件(将/ wp-content / plugins重命名为/ wp-content / oldplugins,或者用SQL查询禁用所有插件),但是再次运气不佳。
对不起,很长的问题。 我希望我已经说清楚了
编辑:这是nginxconfiguration文件,以防万一:)
server { listen 80; server_name www.example.com; rewrite ^/(.*) http://example.com/$1 permanent; } server { listen 80; access_log /var/www/example.com/log/access.log; error_log /var/www/example.com/log/error.log info; server_name example.com; root /var/www/example.com; location / { index index.php; # if the requested file exists, return it immediately if (-f $request_filename) { break; } # all other requests go to WordPress if (!-e $request_filename) { rewrite . /index.php last; } } ## Images and static content is treated different location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { access_log off; expires 30d; root /var/www/example.com; } ## Parse all .php file in the /var/www directory location ~ .php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass backend; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/example.com$fastcgi_script_name; include fastcgi_params; fastcgi_param HTTP_HOST example.com; 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_intercept_errors on; fastcgi_ignore_client_abort on; fastcgi_read_timeout 180; } ## Disable viewing .htaccess & .htpassword location ~ /\.ht { deny all; } }
我想在另一个答案我的问题 :在Apache Web服务器上的源文件夹的Apache文件夹apache:apache作为用户:组,并在'scping'该文件夹到我的新的Nginxnetworking服务器后,该用户和该组不再有效。 我做了适当的chown -R www-data:www-data到新的WP文件夹,但是…可以这个提示来回答吗?
尝试:
location / { try_files $uri $uri/ /index.php; }
nginx是否将适当的“主机”头传递给FastCGI服务器? WordPress检查这个头,如果它不等于数据库中的设置,则执行redirect。 它看起来像你应该检查你的/etc/nginx/fastcgi_params并设置像fastcgi_param HTTP_HOST example.com; 那里。