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

I'm using WPN-XM (stack with Nginx, MariaDB, PHP and OPENSSL) and am trying to setup OpenSSL in a HTTP/HTTPS server. I'm following the instructions from NGINX here and my server starts/stops without errors.

This is my nginx.conf with the "double server":

server {
    listen              80;
    listen              443 ssl;
    server_name         localhost;
    root                www/login;

    # ssl properties
    ssl_certificate      ../../../bin/openssl/certs/cert.pem;
    ssl_certificate_key  ../../../bin/openssl/certs/cert.key;
    ssl_session_timeout  5m;
    ssl_protocols              SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers                HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers  on;

    log_not_found off;
    charset utf-8;

    access_log  logs/access.log  main;

    # handle files in the root path /www
    location / {
        index  index.php index.html index.htm;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   www;

    # pass the PHP scripts to FastCGI server listening on
    location ~ \.php$ {
        try_files      $uri =404;
        fastcgi_index  index.php;
        fastcgi_param  HTTPS on;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;

This is the basic WPN-XM configuration (see here) with a modified server to include a listener for 443 as well as the SSL properties.

I can access my page from http://localhost/foo/index.html but when trying to access it from httpS://localhost/foo/index.html I get a 404.

First afternoon with Nginx. Can someone point me to what I'm doing wrong?


share|improve this question
I suggest using absolute paths in your root directives. – Michael Hampton Nov 23 '13 at 20:41
ok. let me try. thx so far. – frequent Nov 23 '13 at 20:58
Nice that worked! Can you make it an answer, so I can check. Side question: Any idea how to remove the "I don't trust, create an execption" when using OpenSSL? – frequent Nov 23 '13 at 21:17
Use a real certificate and not a self-signed one. – Michael Hampton Nov 23 '13 at 21:18
Ah yes, somehow I expected that answer :-) – frequent Nov 23 '13 at 21:22
up vote 2 down vote accepted

Your root directives should use absolute paths. It's not easy to predict where they are going to attempt to read files from with relative paths.

share|improve this answer
Thanks! Helped. – frequent Nov 23 '13 at 21:22

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.