Arch Linux:
sudo pacman -S elixir
Ubuntu/Debian Linux:
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
sudo apt-get install esl-erlang
sudo apt-get install elixir
Windows, MacOS, BSD:
Take a look at the official instructions
mix local.hex
mix deps.get
mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez
Start your Phoenix server:
iex -S mix phx.server
The API is now served at ws://localhost:4000/socket
.
mix test
To deploy this app using Apache you can start it as usual and set up a reverse proxy with Apache.
First set up a virtual host by creating a file in /etc/apache2/sites-available/
with this content:
<VirtualHost *:80>
ProxyPass / ws://0.0.0.0:4000/
ProxyPassReverse / ws://0.0.0.0:4000/
ServerName example.org
</VirtualHost>
This routes all traffic to port 80 to the local port 4000 using the websockets protocol.
To enable this file run sudo a2enmod yourfile.conf
You also need to enable some Apache modules:
sudo a2enmod proxy_wstunnel
At least that module - if it doesn't work install the others mentioned here and add them to the list.
To make apache aware of all changes restart it: sudo systemctl apache2 restart
Now the API should be reachable at ws://example.org/socket