rstudio/plumber

Improvement of documentation on systemd section

Open

#912 opened on Jul 30, 2023

View on GitHub
 (0 comments) (0 reactions) (0 assignees)R (1,437 stars) (257 forks)batch import
docshelp wantedknowledge :exploding_head:

Description

The systemd part from the official documentation feels a little bit incomplete.

I suggest adding a nginx approach using proxy_pass, after the systemctl enable and start step.

  1. Make sure your Plumber instance is running on 127.0.0.1 on the ExecStart parameter on the service file.
  2. Open the sites-enabled folder on /etc/nginx/ or the correspondent path if you're using a custom nginx installation.
  3. Inside the server block on your desired file (mine is default), create a location block with the name you want.
  4. If your Plumber instance is running on the 6547 port, put the code below inside the newly created block to make your endpoints available on the web.
location /api/ {
proxy_pass http://127.0.0.1:6547;
proxy_http_version 1.1;
}
  1. Restart nginx after the changes.
  2. On this example, your endpoints will be available on https://example.com/api/

I don't recommend using rewrite rules, because the regex parameters can lead to unpredictable behavior when using the endpoints.

Contributor guide