Install Open edX on a local server using an IP address and different port without a domain

In my scenario, I have installed the latest version of Ubuntu on a virtual machine (VM) hosted on a VMWare ESXi instance in a local area network (LAN). I have to install Open edX on the VM using the Tutor method in production mode.

  1. Production platform: true
  2. domain for student: 10.40.2.111
  3. domain for teachers: 10.40.2.111:16001
  4. SSL/TLS certificates: No

I have followed the steps on the official website,
1. installing Docker and Docker Compose,
2. installing and upgrading Tutor
3. Launch Tutor with the specified configuration.

The following image shows the configuration details provided,

here port 16001 is a completely random port and I also tried a few other ports to ensure the port is not used by any other ports.

The URL provided for accessing the CMS and LMS is http://10.40.2.111 and http://10.40.2.111:16001, respectively.

However, I am unable to access the URL http://10.40.2.111:16001 from any device on the network even from the host machine. I do not have a domain and am using a LAN IP. My firewall is disabled. So I can be sure that there is no effect from the firewall.

I have two main problems:
1. How to use different ports for the LMS and CMS with the same LAN IP.
2. How to obtain a domain to work inside the LAN if you cannot use a LAN IP with a port

The default port value for the CMS might be causing problems with your setup.

You can simply use the default values which are http://local.overhang.io/ and http://studio.local.overhang.io/ for testing.

If you would like to use Open edX in production mode inside your local network where other users will be accessing it, I suggest buying a domain and using that instead.

Here is a quick guide on how to configure Open edX with a custom domain on a local domain.

  1. Acquire the domain. Use whatever domain provider you like.
  2. Change nameservers to Cloudflare. Change your authoritative nameservers (Full setup) · Cloudflare DNS docs
  3. Edit your DNS records to point to your Open edX instance. Installing Tutor — Tutor documentation
    You need to disable Cloudflare proxy while adding your local IP.
  4. Make sure your domain is pointing to your local machine. You can simply ping the domain to confirm.
  5. At this point, you can simply enter your domain to complete the installation.
    BONUS 6. If you want HTTPS for your custom domain inside your local network, do the following.
    6.1. Get your Cloudflare API token: Get API keys (legacy) · Cloudflare Fundamentals docs
    6.2. Add the following variable to your config.yaml. This will use a custom Caddy that supports DNS based domain challenges. You can check the code for the image creation here: GitHub - uetuluk/caddy-cloudflare: Caddy module: dns.providers.cloudflare
DOCKER_IMAGE_CADDY: docker.io/uetuluk/caddy-cloudflare:latest

6.3. Add the following plugin to your Tutor installation to use your custom domain with HTTPS.

"""
HTTPS plugin for the tutor. Uses the cloudflare caddyfile plugin to enable DNS based certificate issuance.
YAML version
name: https
version: 0.1.0
patches:
  caddyfile-global:
    email <CLOUDFLARE_EMAIL>
  caddyfile-lms: &tls |
    tls { 
      dns cloudflare <CLOUDFLARE_TOKEN>
    }
  caddyfile-cms: *tls
"""
from tutor import hooks

caddyfile_global = (
"caddyfile-global",
"""email <CLOUDFLARE_EMAIL>"""
)

caddyfile_tls = """tls { 
  dns cloudflare <CLOUDFLARE_TOKEN>
}
"""

caddyfile_lms = ("caddyfile-lms", caddyfile_tls)
caddyfile_cms = ("caddyfile-cms", caddyfile_tls)

hooks.Filters.ENV_PATCHES.add_items([caddyfile_global, caddyfile_lms, caddyfile_cms])

Don’t forget to replace <CLOUDFLARE_EMAIL> and <CLOUDFLARE_TOKEN> with your own values.
6.4. Enjoy HTTPS with your custom domains on your local network.

1 Like