Operating system
Linux
Joplin version
3.0.12
Desktop version info
Joplin 3.0.12 (prod, linux)
Client ID: xxx
Sync Version: 3
Profile Version: 47
Keychain Supported: No
Revision: a64d6e3
Backup: 1.4.1
Sync target
Joplin Server
What issue do you have?
Hi Everyone,
I installed the joplin/server:latest on the VPS from docker hub (v3.0.1). Here is the env config:
APP_BASE_URL=https://xxx.xxx/joplin
APP_PORT=23618
DB_CLIENT=pg
POSTGRES_PASSWORD=*************
POSTGRES_DATABASE=joplin
POSTGRES_USER=joplin
POSTGRES_PORT=5432
POSTGRES_HOST=localhost
NGINX acts as a proxy server, here is its config:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
application/xml application/xml+rss text/javascript;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
listen 80;
server_name xxx.xxx;
location / {
root /etc/nginx/html;
index index.html;
}
location /.well-known/acme-challenge/ {
alias /var/www/xxx.xxx/.well-known/acme-challenge/;
}
}
server {
listen 443 ssl;
server_name xxx.xxx;
ssl_certificate ssl/fullchain.pem;
ssl_certificate_key ssl/privkey.pem;
location / {
root /etc/nginx/html;
index index.html;
}
location /joplin/ {
proxy_pass http://localhost:23618/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Client-Verify SUCCESS;
proxy_set_header X-Client-DN $ssl_client_s_dn;
proxy_set_header X-SSL-Subject $ssl_client_s_dn;
proxy_set_header X-SSL-Issuer $ssl_client_i_dn;
proxy_read_timeout 1800;
proxy_connect_timeout 1800;
client_max_body_size 0; # do not check uploading file size
}
}
}
I try to setup sync in the desktop application v3.0.12. An error occurs when pressing the "Check synchronisation configuration" button.
Error. Please check that URL, username, password, etc. are correct and that the sync target is accessible. The reported error was:
Error 404 Not Found: {"detail":"Not Found"} (Code 404)
But the site is accessible and I can log in my account.
Request in the nginx access log on pressing "Check synchronisation configuration" button:
"POST /joplin/api/sessions HTTP/1.1" 404 22 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
Did you try the location configuration without the trailing slash?
location /joplin {
Just tried. Same error in the application. Web interface reported me "Path not found".
I'm not really knowing what the problem is. I'm just a copy&paste Admin.
I use a subdomain for my Joplin Server and have a very simple reverse-proxy config under /etc/nginx/conf.d. The ssl magic is done by certbot. And this works for me.
Maybe this is also a way for you? You can then reach your server under joplin.domain.tld.
If you want to try this, make a new file named joplin.conf under /etc/nginx/conf.d and fill it up with this simple reverse-proxy config:
server {
server_name joplin.domain.tld;
location / {
proxy_pass http://localhost:22300/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
joplin.domain.tld have to be your own domain with a subdomain.
After that, I use certbot to gain a ssl certificate. Maybe you have to install certbot first. and the run just sudo certbot and chose your domain with the right number. Certbot does the rest for you.
After that, your joplin.conf under /conf.d looks a little bit different, like this:
server {
server_name joplin.domain.tld;
location / {
proxy_pass http://localhost:22300/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 2048M;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/joplin.domain.tld/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/joplin.domain.tld/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.domain.tld) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name joplin.domain.tld;
listen 80;
return 404; # managed by Certbot
}
If you want to keep your config like it is, you maybe have to take a look at the proxy_set_header-functions. There is a difference between yours and mine. Maybe you have to add proxy_set_header X-Forwarded-Proto $scheme;. But this is just a wild guess. I don't know really for what this is for. 
Have you double check, that you have set https:// in your synchronisation URL in Joplin? Because you only listen on port 443 and not on port 80 and you don't have an automatic redirect to ssl and port 443.
I hope this thoughts will help you.
Unfortunately, I can't use a subdomain for joplin only. Several web apps are served by the same domain. I use acme.sh to manage certificates. Joplin Server web interface works properly along with other services.
Okay, I edited my config as close to yours as possible (added X-Forwarded-Proto, removed extra lines, etc.) but nothing changed in operation. I checked https in the desktop app again and added a forced rewrite to https from port 80 in nginx.conf. Same error in the application. Also, I don't see any messages in log.txt when trying to sync.
Another interesting fact. Joplin desktop request to https://xxx.yyy/joplin/api/sessions. When I trying to open such page in the browser I get a strange screen with json tab with single field - {"detail":"Not Found"}.
curl https://xxx.yyy/joplin/api/sessions -v
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 404 Not Found
Oh, what a dumb I am. I have another location in the nginx.conf for another service. There is a wildcard there
location ~* /(dashboard|api|docs|redoc|openapi.json)
When I removed api from the wildcard, the sync started working.
1 Like
system
Closed
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.