Rewrite docs

This commit is contained in:
Nikita Karamov 2023-03-18 02:25:06 +01:00
parent f811ba371d
commit 3d369d4265
No known key found for this signature in database
GPG key ID: 41D6F71EE78E77CD

View file

@ -37,67 +37,64 @@ Self-hosting **Share₂Fedi** outside of Vercel requires some extra setup:
**Prerequisites:** modern Node.js (v16 or later), `pnpm`. **Prerequisites:** modern Node.js (v16 or later), `pnpm`.
1. Install the dependencies: 1. Install dependencies.
```sh ```sh
pnpm install pnpm install
``` ```
2. Build the static files: 2. Build.
```sh ```sh
pnpm build pnpm build
``` ```
3. Run the backend server for the form: 3. Run server.
> By default, this will only listen on localhost port 3000. To enable
> listening on a ceratin hostand/or port, set the `HOST` and `PORT`
> environment variables, respectively.
```sh ```sh
node api/share.js node dist/server/entry.mjs
``` ```
alternatively, if you want to run the process in the background: alternatively, if you want to run the process in the background:
```sh ```sh
pm2 start api/share.js --watch --ignore-watch="node_modules" pm2 start dist/server/entry.mjs --watch --ignore-watch="node_modules"
``` ```
> You can find a summary for pm2 at: > You can find a summary for pm2 at:
> https://pm2.keymetrics.io/docs/usage/quick-start/ > https://pm2.keymetrics.io/docs/usage/quick-start/
4. Set up a web server > More information about self-hosting an Astro website with Node:
> https://docs.astro.build/en/guides/integrations-guide/node/#standalone
Basically, you need to run a server that would proxy the requests to 4. Set up a reverse proxy.
`/api/share`. to the Node.js server you started. Here's how to achieve this
in various HTTP servers: Basically, you need to run a reverse proxy that would redirect all incoming
requests to `localhost:3000`. Here's how to achieve this in various HTTP
servers:
1. Apache 1. Apache
```apacheconf ```apacheconf
DocumentRoot "<PATH_TO_SHARE2FEDI>/dist" ProxyPass "/" "http://localhost:3000/"
ProxyPass "/api/share" "http://localhost:8080/"
``` ```
2. Nginx 2. Nginx
```nginxconf ```nginxconf
root <PATH_TO_SHARE2FEDI>/dist; location / {
index.html; proxy_pass http://localhost:3000/;
location /api/share {
proxy_pass http://localhost:8080/;
} }
``` ```
3. Caddy 3. Caddy
```caddy ```caddy
root * <PATH_TO_SHARE2FEDI>/dist; reverse_proxy :3000
try_files index.html
handle_path /api/share {
reverse_proxy localhost:8080
}
``` ```
## See also ## See also