Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

Commit

Permalink
add nginx config for obsidian publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Cheong committed Aug 30, 2023
1 parent b703cb3 commit 53e4d8e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ These features are not in the latest release but in the main branch. They might
- Fix bugs
- Publish


## Setup

- `git clone https://github.com/acheong08/obsidian-sync`
- `cd obsidian-sync`
- `export HOST=<YOUR DOMAIN NAME>` - Not necessary when running on localhost
Expand All @@ -53,16 +53,29 @@ map $http_upgrade $connection_upgrade {
'' close;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
listen 80;
listen [::]:80;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3000/;
}
server_name _;
server_name <your domain name>; # e.g. api.obsidian.md
}
# This is for obsidian publish (Optional)
server {
listen 80;
listen [::]:80;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3000/published/;
}
server_name <another domain name>; # e.g. publish.obsidian.md
}
```

Expand All @@ -88,8 +101,8 @@ This plugin will not be part of the official community plugins list.
- Install https://github.com/acheong08/rev-obsidian-sync-plugin
- Go to settings
- Set API endpoint
- e.g. `https://obsidian.yourdomain.com`
- For development: `http://127.0.0.1:3000`
- e.g. `https://obsidian.yourdomain.com`
- For development: `http://127.0.0.1:3000`

Known bugs:

Expand Down
2 changes: 1 addition & 1 deletion cmd/obsidian-sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
publishAPI.POST("upload", handlers.UploadFile)
publishAPI.POST("remove", handlers.RemoveFile)

router.GET(":slug/*path", handlers.GetPublishedFile)
router.GET("/published/:slug/*path", handlers.GetPublishedFile)

router.GET("/", handlers.WsHandler)
router.GET("/ws", handlers.WsHandler)
Expand Down

0 comments on commit 53e4d8e

Please sign in to comment.