Nginx server 301 Moved permanently

Posted by user145714 on Server Fault See other posts from Server Fault or by user145714
Published on 2012-11-16T16:54:56Z Indexed on 2012/11/16 17:01 UTC
Read the original article Hit count: 228

Filed under:
|

When I did a curl -v http://site-wordpress.com:81 I received this result:

  • 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

Seems like this line in my fastcgi_params is causing grief.

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

If I remove this line , I get HTTP/1.1 200 OK but I get a blank page.

This is my config:

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;
            }

}

This config works with ip and port 80. But now I need to use a domain name and port 81, which doesn't work. Could someone please help. Thanks.

© Server Fault or respective owner

Related posts about nginx

Related posts about Wordpress