Advertisement
lvalnegri

nginx.config

Apr 20th, 2019
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 2.63 KB | None | 0 0
  1. ## Nginx config file for Cloud Analytics Machine as explained in <WeR> Meetup Workshops (work in progress...)
  2. ## Meetup: https://www.meetup.com/WeR-stats/
  3. ## Github: https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science
  4.  
  5. map $http_upgrade $connection_upgrade {
  6.         default upgrade;
  7.         '' close;
  8. }
  9.  
  10. server {
  11.  
  12.         root /var/www/html;
  13.  
  14.         index index.php index.html index.htm index.nginx-debian.html;
  15.  
  16.         server_name we-r.london www.we-r.london;
  17.  
  18.         location / {
  19.                 # First attempt to serve request as file, then as directory, then fall back to displaying a 404.
  20.                 try_files $uri $uri/ =404;
  21.         }
  22.  
  23.         # RStudio Server Open Sourcce
  24.         # see https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science#install-rstudio-server
  25.         location /rstudio/ {
  26.                 proxy_pass http://127.0.0.1:8787/;
  27.                 proxy_http_version 1.1;
  28.                 proxy_set_header Upgrade $http_upgrade;
  29.                 proxy_set_header Connection $connection_upgrade;
  30.         }
  31.  
  32.         # Shiny Server Open Sourcce
  33.         # see https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science#install-shiny-server
  34.         location /shiny/ {
  35.                 proxy_pass http://127.0.0.1:3838/;
  36.                 proxy_http_version 1.1;
  37.                 proxy_set_header Upgrade $http_upgrade;
  38.                 proxy_set_header Connection $connection_upgrade;
  39.                 rewrite ^(/shiny/[^/]+)$ $1/ permanent;
  40.         }
  41.  
  42.         # change <appname> with the subfolder you want to protect
  43.         # do not use $PUB_PATH as the path for the *public* shared folder, use instead its complete name
  44.         # remember to run "htpasswd -c $PUB_PATH/shiny_server/pwds/appname.pwds username" to create users/passwords
  45.         # see https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science#shiny-auth
  46.         location /shiny/appname/ {
  47.                auth_basic "Username and Password are required";
  48.                auth_basic_user_file /usr/local/share/public/shiny_server/pwds/appname.pwds;
  49.         }
  50.  
  51.         # PHP needed to run DBNinja as MySQL Web Client
  52.         # see https://github.com/WeR-stats/workshops/tree/master/setup_cloud_machine_data_science#dbninja
  53.         location ~ \.php$ {
  54.                 include snippets/fastcgi-php.conf;
  55.                 fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  56.         }
  57.  
  58.         # deny access to .htaccess files, if Apache's document root concurs with nginx's one
  59.         location ~ /\.ht {
  60.                 deny all;
  61.         }
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement