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

Here is my nginx config for port 443:

server {
    listen           *:443;

    ssl         on;
    ssl_protocols       SSLv3 TLSv1;
    ssl_certificate     /www/certs/;
    ssl_certificate_key /www/certs/;

     access_log /var/log/;
    location ~* .(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|tar|wav|bmp|rtf|swf|ico|flv|txt|xml|docx|xlsx)$ {
        root /www/;
        index index.html index.php;
        access_log off;
        expires 30d;
    location ~ /.ht {
        deny all;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-for $remote_addr;
        proxy_set_header Host $host;
        proxy_connect_timeout 60;
        proxy_send_timeout 90;
        proxy_read_timeout 90;
        proxy_redirect off;
        proxy_set_header Connection close;
        proxy_pass_header Content-Type;
        proxy_pass_header Content-Disposition;
        proxy_pass_header Content-Length;

Question 1: Why am I being asked to enter a PEM pass to the cert? How can I enver the password in the nginx config?

178-162-174-212:/usr/bin# service apache2 restart
Restarting web server: apache2.

178-162-174-212:/usr/bin# service nginx restart
Restarting nginx: Enter PEM pass phrase:
Enter PEM pass phrase:
[emerg]: bind() to failed (98: Address already in use)
[emerg]: bind() to failed (98: Address already in use)
[emerg]: bind() to failed (98: Address already in use)
[emerg]: bind() to failed (98: Address already in use)
[emerg]: bind() to failed (98: Address already in use)
[emerg]: still could not bind()

Question 2: Why is there a conflict on port 443?

Apache config:

NameVirtualHost *:81
Listen 999

<IfModule mod_ssl.c>
    Listen 443

<IfModule mod_gnutls.c>
    Listen 443

If I comment out the line "Listen 443" that does not work.

share|improve this question

You have both Apache and nginx configured to listen on port 443.

It looks like your intention is to have nginx take control of that port, so you'll want to remove that configuration from Apache, and restart both services: Apache first, then nginx. This should allow nginx to bind to port 443 and serve those requests.

As for the certificate passphrase, nginx doesn't support saving the passphrase for des-encrypted private keys in the config file (good for them; the obscurity granted by that is worthless). Decrypt the private key (and make sure it's only readable by the user that nginx is running as):

mv /www/certs/ /www/certs/
openssl rsa -in /www/certs/ -out /www/certs/
share|improve this answer
If I remove Listen 443 from apache then 443 port not works – Kirill Firsov May 19 '11 at 8:58
Did you restart nginx after apache like @Shane suggested? – Eduardo Ivanec May 19 '11 at 11:18

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.