- nvm -
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash - Node.js -
nvm install v6.0.0 - pm2 -
npm install pm2 -g
- Apache Site
cd /var/www
git clone YOUR_PROJECT_URL
cd YOUR_PROJECT_DIR
npm install
Setup your database if needed.
cd /etc/apache2/sites-available
nano YOUR_PROJECT_NAME.conf
Put in this contents:
<VirtualHost *:80>
ServerAdmin YOUR_EMAIL
ServerName YOUR_HOST_NAME
DocumentRoot /var/www/YOUR_PROJECT_DIR/public/
ProxyRequests on
ProxyPass / http://localhost:YOUR_APP_PORT/
</VirtualHost>
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2ensite YOUR_PROJECT_NAME
sudo service apache2 reload
cd /var/www/draw_together
npm install
node YOUR_BACKEND_JS_SCRIPT
Add an entry in the file that points YOUR_HOST_NAME to your Ubuntu server's IP address.
pm2 start YOUR_SCRIPTpm2 listpm2 show ID
sudo a2enmod proxy_wstunnel
sudo a2enmod rewrite
Add the four lines in the middle
<VirtualHost *:80>
ServerAdmin YOUR_EMAIL
ServerName YOUR_HOST_NAME
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:YOUR_APP_PORT/$1 [P,L]
DocumentRoot /var/www/YOUR_PROJECT_DIR/public/
ProxyRequests on
ProxyPass / http://localhost:YOUR_APP_PORT/
</VirtualHost>