3

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 127.0.0.1:9100
    #
    location ~ \.php$ {
        try_files      $uri =404;
        fastcgi_pass   127.0.0.1:9100;
        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.

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

Thanks!

frequent
  • 167
  • 8

1 Answers1

2

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.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972