4

I'm migrating some sites from Apache to Nginx and trying to get one configured to answer SSL requests. At the moment I'm getting a server not responding error. If I switch to port 80 I get an nginx error (not worried about the error itself since nginx is at least serving it up).

For this site, I want it to only answer ssl requests. Here's what the server block looks like:

server {
  listen      443;
  server_name dev.project.mydomain.net;
  root        /opt/dev/project-root;
  index       index.php;

  ssl                  on;
  ssl_certificate      /etc/ssl/certs/mycert.crt;
  ssl_certificate_key  /etc/ssl/certs/mycert.pem;

  access_log /var/log/nginx/vh.dev-project.access.log;
  error_log  /var/log/nginx/vh.dev-project.error.log;

  location /aliasing/ {
    alias /opt/dev/project-root/aliased;
  }

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  #
  location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi_params;
  }
}

Any insight would be much appreciated.

UPDATE

My http block:

http {
    include       /etc/nginx/mime.types;

    access_log  /var/log/nginx/access.log;

    sendfile        on;

    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
4
  • Your server-block itself looks okay. Can you post the rest of your configuration? (E.g. nginx.conf)
    – pkhamre
    Aug 16, 2012 at 14:09
  • 1
    And btw, since nginx 0.7.14 the preferred way of enabling SSL is by using the ssl parameter in the listen directive like this: listen 443 default_server ssl;
    – pkhamre
    Aug 16, 2012 at 14:10
  • Thanks for the insight. What is the default_server component? This is just one virtual host, so I want to be sure it's not doing anything outside of that scope. Aug 16, 2012 at 14:35
  • @pkhamre - Added my http block above. Any other config tips you may have are always welcome. Thanks again. Aug 16, 2012 at 15:04

1 Answer 1

10

You have opened up port TCP443 on your firewall if you have one enabled, I hope? (It's an obvious one, but I've missed this before myself.)

2
  • You're close. The port was open, but not forwarding properly from the external router. Ugh. Aug 17, 2012 at 11:35
  • man, u saved my life!
    – rizidoro
    Jun 21, 2013 at 11:41

You must log in to answer this question.

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