Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

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/nginx.pid; 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

1 Answer 1

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 site-wordpress.com:81 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 site-wordpress.com:81 I can access the site using ipaddress:81 but not using site-wordpress.com:81 which gives me "The page isn't redirecting properly" on my firefox browser. –  user145714 Nov 16 '12 at 20:50

Your Answer

 
discard

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.