## Nginx config file for Cloud Analytics Machine as explained in Meetup Workshops (work in progress...) ## Meetup: https://www.meetup.com/WeR-stats/ ## Github: https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { root /var/www/html; index index.php index.html index.htm index.nginx-debian.html; server_name we-r.london www.we-r.london; location / { # First attempt to serve request as file, then as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } # RStudio Server Open Sourcce # see https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science#install-rstudio-server location /rstudio/ { proxy_pass http://127.0.0.1:8787/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } # Shiny Server Open Sourcce # see https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science#install-shiny-server location /shiny/ { proxy_pass http://127.0.0.1:3838/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; rewrite ^(/shiny/[^/]+)$ $1/ permanent; } # change with the subfolder you want to protect # do not use $PUB_PATH as the path for the *public* shared folder, use instead its complete name # remember to run "htpasswd -c $PUB_PATH/shiny_server/pwds/appname.pwds username" to create users/passwords # see https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science#shiny-auth location /shiny/appname/ { auth_basic "Username and Password are required"; auth_basic_user_file /usr/local/share/public/shiny_server/pwds/appname.pwds; } # PHP needed to run DBNinja as MySQL Web Client # see https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science#dbninja location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; } # deny access to .htaccess files, if Apache's document root concurs with nginx's one location ~ /\.ht { deny all; } }