Nginx服务器301永久移动

当我做了curl -v http://site-wordpress.com:81我收到了这个结果:

* About to connect() to site-wordpress.com port 81 (#0) * Trying ip... connected * Connected to site-wordpress.com (ip) port 81 (#0) > GET / HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 NSS/3.12.6.2 zlib/1.2.3 libidn/1.18 libssh2/1.2.2 > Host: site-wordpress.com:81 > Accept: */* > < HTTP/1.1 301 Moved Permanently < Server: nginx/1.2.4 < Date: Fri, 16 Nov 2012 16:28:19 GMT < Content-Type: text/html; charset=UTF-8 < Transfer-Encoding: chunked < Connection: keep-alive < X-Pingback: The URL above/xmlrpc.php < Location: The URL above 

在我的fastcgi_params中看起来像这条线正在引起悲伤。

 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 

如果我删除这一行,我得到HTTP / 1.1 200确定,但我得到一个空白页。

这是我的configuration:

 server { listen 81; server_name site-wordpress.com; root /var/www/html/site; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; index index.php; if (!-e $request_filename){ rewrite ^(.*)$ /index.php break; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; # port where FastCGI processes were spawned fastcgi_index index.php; include /etc/nginx/fastcgi_params; include /etc/nginx/mime.types; } location ~ \.css { add_header Content-Type text/css; } location ~ \.js { add_header Content-Type application/x-javascript; } } 

此configuration适用于IP和端口80.但现在我需要使用域名和端口81,这是行不通的。 有人可以帮忙。 谢谢。

这是您的WordPressconfiguration的问题,而不是您的nginxconfiguration。 如果你的意思是在端口81上运行服务器,那么你必须修改你的WordPress选项中的URL。