Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I did a curl -v I received this result:

* About to connect() to port 81 (#0)
*   Trying ip... connected
* Connected to (ip) port 81 (#0)

> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-unknown-linux-gnu) libcurl/7.19.7 NSS/ zlib/1.2.3 libidn/1.18 libssh2/1.2.2
> Host:
> 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;
       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;  # 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.

share|improve this question
Can you post the contents of your fastcgi_params and nginx.conf files? – gmck Nov 16 '12 at 19:09
user sysops; worker_processes 2; error_log /var/log/nginx/error.log warn; pid /var/run/; events { worker_connections 1024; } http { default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log; sendfile on; tcp_nodelay on; keepalive_timeout 15; include /etc/nginx/sites-enabled/*; } – user145714 Nov 16 '12 at 20:14

This is a problem with your WordPress configuration, not your nginx configuration. If you really mean to run the server on port 81, then you have to modify the URL in your WordPress options.

share|improve this answer
oh yes, thanks. I did that for wordpress configs, via the mysql home and siteurl option_name and the option_value for both is but still didn't work. Is there somewhere else I might have missed ? – user145714 Nov 16 '12 at 20:17
Also I checked in the Admin page in the General settings. For both Wordpress and Site address , they are I can access the site using ipaddress:81 but not using which gives me "The page isn't redirecting properly" on my firefox browser. – user145714 Nov 16 '12 at 20:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.