404 Not Found with Let's Encrypt for NGINX and Learning Locker
December 26, 2019 02:02PM
Hello,

I installed Learning Locker (https://docs.learninglocker.net/guides-installing/) on a Google Cloud VM and verified that everything works for HTTP, but will need to set up HTTPS to send statements. I followed the instructions here https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/ to create a Let's Encrypt certificate, but am getting stuck on Step 2.

It says to create a conf file for my domain name, but when I do that then navigating to my domain gives me a 404 Not Found error. I suspect that this is due to Learning Locker having its own conf file already (learninglocker.conf).

Does anyone know how I can resolve this issue? I've posted the learninglocker.conf file below in case it helps.

learninglocker.conf:

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name myserver.com; // removed just for this post
server_tokens off;

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

# Max request size
client_max_body_size 20M;
large_client_header_buffers 4 256k;

root /usr/local/learninglocker/current/webapp/ui/dist/public;

# xAPI endpoints
location ~* ^/data/xAPI(.*)$ {
proxy_pass http://127.0.0.1:8081/data/xAPI$1$is_args$args;
}

# API endpoints
location = /api {
rewrite /api / break;
proxy_redirect off;
proxy_pass http://127.0.0.1:8080;
}

location ~* ^/api(.*)$ {
proxy_pass http://127.0.0.1:8080$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

# All other traffic directed to statics or Node server
location / {
try_files $uri @node_server;
}

# Node UI server
location @node_server {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

# Load configuration files for the default server block.
error_page 404 /404.html;
location = /40x.html {
root /usr/share/nginx/html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# We don't need .ht files with nginx.
location ~ /\.ht {
deny all;
}
}
Re: 404 Not Found with Let's Encrypt for NGINX and Learning Locker
December 27, 2019 01:40PM
I figured it out. I just needed to place the certificate info into the learninglocker.conf file (inside the server block) and not have it in the domain-name.conf.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready