Homepage    |    GitHub    |    API    |    FAQ

[joplin-server] Reverse proxy config (Nginx) for Joplin and Discourse on a shared server

Server is Ubuntu 20.04
Joplin client 2.19
Joplin Server 2.28 beta (Docker image)
Nginx 1.21.1 (fresh install)

I am trying to run both discourse and a joplin server on my Ubuntu 20.04 instance but have had no luck with configuring the Nginx reverse proxy. I do have it working with the discourse instance and have installed certs from Let's Encrypt for both servers.

The names (example, domain is obviously not real) for the two servers are:

discourse.mydomain.net
joplin.mydomain.net

The current config that I have, which works for the discourse server is this:

server {
        server_name discourse.mydomain.net; # ← change this
        location / {
                proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:; # ←- volume: same like yml file
                proxy_set_header Host $http_host;
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Real-IP $remote_addr;
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/discourse.mydomain.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/discourse.mydomain.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
    if ($host = discourse.mydomain.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80; listen [::]:80;
        server_name discourse.mydomain.net;
    return 404; # managed by Certbot

}

When I try to add a server description all that seems to happen is that when I attempt to navigate to joplin.mydomain.net I get referred to https://discourse.mydomain.net, something is clearly wrong with my config but I have been unable to get it sorted.

This is the Joplin config:

server {
    server_name joplin.mydomain.net;

    location / {
        proxy_pass http://127.0.0.1:22300;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-Host $host;
        client_max_body_size 400M;
    }

    ssl_certificate /etc/letsencrypt/live/joplin.mydomain.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/joplin.mydomain.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = joplin.mydomain.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80; listen [::]:80;
        server_name joplin.mydomain.net;
    return 404; # managed by Certbot

}

I am hoping someone in this group with more expertise than I have can help me get this going. I feel like it is a simple error but my lack of experience with configuring nginx makes it less obvious to me. Any assistance would be most welcome.

Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.