From 99a4c4800e2e1aff2c117b29218f82085e893924 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Tue, 26 Sep 2023 22:03:52 +0200 Subject: [PATCH 1/2] more documentation --- README.md | 5 ++++- nginx/kosynrs.conf | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 nginx/kosynrs.conf diff --git a/README.md b/README.md index 22d5545..d8262bf 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # KOreader Sync Server -This is an experimental KOreader sync server, implemented in Rust. \ No newline at end of file +This is a KOreader sync server, implemented in Rust. + +## Installation +Just compile it with `cargo build --release`. You can then copy the executable for example to `/usr/local/bin/`. If you want to start the service automatically, you can adopt the example systemd file for your needs. You can also use nginx as a reverse proxy, so that the sync server listens on port 443. \ No newline at end of file diff --git a/nginx/kosynrs.conf b/nginx/kosynrs.conf new file mode 100644 index 0000000..6c99255 --- /dev/null +++ b/nginx/kosynrs.conf @@ -0,0 +1,14 @@ +server { + listen 443 ssl; + server_name kosync.example.com; + ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot + + access_log /var/log/nginx/kosync_access.log; + error_log /var/log/nginx/kosync_error.log; + + + location / { + proxy_pass http://localhost:3003; + } +} From 65b92f85325ae17daa12077407066002af4e05fc Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Tue, 26 Sep 2023 22:04:01 +0200 Subject: [PATCH 2/2] only listen locally --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 45cff86..93483da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,7 +49,7 @@ async fn main() { .route("/healthcheck", get(healthcheck)); // run it with hyper on localhost:3000 - axum::Server::bind(&"0.0.0.0:3003".parse().unwrap()) + axum::Server::bind(&"127.0.0.1:3003".parse().unwrap()) .serve(app.into_make_service()) .await .unwrap();