http {
# Enable websockets (needed for Shiny) -- I don't know if this part matters.
map $http_upgrade $connection_upgrade {
default upgrade; '' close;
}
server { listen 80;
# You can edit this file if you want a default page.
root /usr/share/nginx/html;
index index.html index.htm;
# I think this was necessary to get it to work.
# We'll do more with this in Chapter 13.
server_name ec2-12-345-678-90.compute-1.amazonaws.com;
}
}
sudo systemctl restart nginx
Test it at your “Public IPv4 DNS”.
Add RStudio routing
Add a location block inside the http / server section of nginx.conf.
location /rstudio/ {
# Needed only for a custom path prefix of /rstudio
rewrite ^/rstudio/(.*)$ /$1 break;
proxy_pass http://localhost:8787;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 20d;
# Not needed if www-root-path is set in rserver.conf
proxy_set_header X-RStudio-Root-Path /rstudio;
# Optionally, use an explicit hostname and omit the port if using 80/443
proxy_set_header Host $host:$server_port;
}
sudo systemctl restart nginx
Test it at your “Public IPv4 DNS” /rstudio.
Add plumber api routing
Add a location block each time you want to add an API.
location /palmer/ {
# Check the book to see if he has added more!
proxy_pass http://localhost:8555/;
proxy_set_header Host $host;
}
sudo systemctl restart nginx
Test it at your “Public IPv4 DNS” /palmer/stats and /palmer/__docs__/.
Meeting Videos
Cohort 1
Meeting chat log
00:21:29 novica nakov: it's more fun with more than one key :)
00:22:45 novica nakov: no you copied in your local folder
00:28:28 Tinashe Tapera: ssh-copy-id: https://www.ssh.com/academy/ssh/copy-id
00:41:20 Gus Lipkin: There’s a gui Docker image available for nginx that makes things easier (or more complicated depending on how you feel): https://nginxproxymanager.com/
00:43:09 Tinashe Tapera: This is really nice
00:51:45 Ahmed: pretty cool!