0

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;
        server_name    www.example.com;
        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 https://www.example.com:883

But i got the following exception

socket: Connection refused
connect:errno=111

Any helps are greatly appreciated.

EDIT :-

@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
connect:errno=111

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.

1 Answer 1

1

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.

1
  • @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? Mar 13, 2012 at 5:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .