Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I'm trying to connect NGINX web server using Passenger for a Rails project. I've checked my configuration file, and i gave connection to sites over port 883.

This is my configuration file as follows:

http {
    passenger_root /home/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11;
    passenger_ruby /home/.rvm/wrappers/ruby-1.9.2-p290/ruby;

    server {
        listen         883;
        root         /home/samples/public;
        passenger_enabled on;

        ssl                  on;
        ssl_certificate      /opt/nginx/conf/server.cert;
        ssl_certificate_key  /opt/nginx/conf/server.key;

        location / {
          root   html;
          index  index.html index.htm;

Start NGINX web server using the following command

sudo /etc/init.d/nginx start
Starting nginx:                                            [  OK  ]

sudo /etc/init.d/nginx status
nginx (pid  19575) is running...

Now the NGINX web server gets started, and i enter the below command for accessing of server connection

openssl s_client -connect

But i got the following exception

socket: Connection refused

Any helps are greatly appreciated.


@Shane Madden - Thanks for the response!

I tried the changes you had mentioned. After that i restarted my NGINX web server.

sudo /etc/init.d/nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]

sudo /etc/init.d/nginx status
nginx (pid  29715) is running...

Finally i check with the below command

sudo openssl s_client -connect localhost:883
socket: Connection refused

sudo lsof -i
nginx    29715     root    6u  IPv4 3840109      0t0  TCP *:http (LISTEN)
nginx    29717    nginx    6u  IPv4 3840109      0t0  TCP *:http (LISTEN)

Hence, there is no difference after changing the steps that you have said. Still i'm getting the same behavior.

share|improve this question

You're trying to connect to the public DNS name - that's a good recipe for inconsistent results, depending on whether the server is actually bound to the public address or whether there's NAT involved, whether the name's overridden in the hosts file.. and any number of other complexities depending on your environment.

Verify that nginx is listening correctly:

lsof -i

Then verify that you can connect to it without involving the complexities of name resolution and public addressing:

openssl s_client -connect localhost:883

That's a much more controlled test of the service working on that specific SSL port - if you're still having issues after that, edit your question with the behavior that you're seeing.

share|improve this answer
Thanks for the response! See my edit part! – diya Mar 13 '12 at 3:57
@amala You have two instances of nginx running, as different users - and neither is bound to port 883? Get all of the instances stopped first, then try to start it up. Where's your configuration file stored? Is it somewhere that's actually getting pulled into the config that nginx is using? – Shane Madden Mar 13 '12 at 5:26

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.