Skip to content

Instantly share code, notes, and snippets.

@paulproteus
Created April 17, 2015 20:27
Show Gist options
  • Save paulproteus/9466a40c4d40ec4b7f8d to your computer and use it in GitHub Desktop.
Save paulproteus/9466a40c4d40ec4b7f8d to your computer and use it in GitHub Desktop.
Sandstorm + nginx, just http (no https)
# This is an example nginx config used to serve your Sandstorm server without SSL/TLS.
#
# Definitions like these should go in the "http" block of your nginx config.
# Configuration for Sandstorm shell.
server {
listen 80;
server_name localhost; # no need to customize this line
location / {
proxy_pass http://127.0.0.1:6080;
# Forward the Host header, which is used to route requests for
# static content published from Sandstorm apps.
proxy_set_header Host $http_host;
# Forward WebSocket.
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
# Allow large spk uploads from the /install form and allow grains to receive large uploads.
client_max_body_size 256M;
}
# For WebSocket forwarding, we want to forward the `Connection` header.
# This "map" declaration helps with that.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
@paulproteus
Copy link
Author

Note that this means your data is accessible over HTTP not HTTPS! I look forward to easy HTTPS integrated into Sandstorm "soon".

To use this, run:

sudo -s  # become root
sudo apt-get install -y nginx  # make sure nginx is installed

cd /etc/nginx/sites-available/
wget https://gist.githubusercontent.com/paulproteus/9466a40c4d40ec4b7f8d/raw/f093c5c1a0899ecf0e2ed06b989764f0a2913e8e/nginx-default -O default
sudo service nginx restart

Optionally, change your Sandstorm to now only listen on localhost via /opt/sandstorm/sandstorm.conf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment