Last active
February 7, 2017 18:27
-
-
Save ympons/c4dfece4fe09b521360cb2f31f3c6312 to your computer and use it in GitHub Desktop.
Install Elixir on Ubuntu box (Ubuntu 12.04/14.04/16.04)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install Erlang & Elixir on Ubuntu box (production ready) | |
# Install erlang and elixir | |
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb | |
sudo apt-get update -y | |
sudo apt-get install -y esl-erlang elixir erlang | |
# Install git and nginx | |
sudo apt-get install -y git nginx | |
# Setup server with nginx | |
sudo touch /etc/nginx/sites-available/myapp | |
sudo ln -s /etc/nginx/sites-available/myapp /etc/nginx/sites-enabled | |
cat <<'EOF' >/etc/nginx/sites-available/myapp | |
stream myapp { | |
server 127.0.0.1:8080; | |
} | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { | |
listen 80; | |
server_name *.compute-1.amazonaws.com; | |
location / { | |
try_files $uri @proxy; | |
} | |
location @proxy { | |
include proxy_params; | |
proxy_redirect off; | |
proxy_pass http://myapp; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
} | |
} | |
EOF | |
# Restart nginx server | |
sudo service nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment