-
-
Save KarlGl/2cd1cefe0c8ba097898a to your computer and use it in GitHub Desktop.
Steps to setup a VPS for general web stuff
This file contains hidden or 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
In these examples my username is k | |
* Gain ssh access via "serial console" in the control pannel for one hour. | |
* Change root password with control pannel. | |
* useradd -s /bin/bash -m -d /home/k -g ssh k | |
on local machine: | |
* ssh-keygen -t rsa | |
* cat ~/.ssh/id_rsa.pub | |
on remote (as root): | |
* mkdir -p /home/k/.ssh && vim /home/k/.ssh/authorized_keys | |
* (paste key and save) | |
* vim /etc/ssh/sshd_config | |
* Add or uncomment this to the file and save it. | |
* PasswordAuthentication no | |
* restart ssh | |
* apt-get update | |
* apt-get install -y sudo | |
* usermod -a -G sudo k | |
* visudo | |
* add this to the top of the file | |
* Defaults rootpw | |
* Defaults:k timestamp_timeout=-1 | |
* now to fix the locale shit: | |
* sh -c "echo 'LC_ALL=en_AU.UTF-8\nLANG=en_AU.UTF-8' >> /etc/default/environment" | |
Now you can exit, logout, and login without no password as non root user only from your computer. | |
* shh k@ip | |
* sudo apt-get install -y git man npm nodejs-legacy curl | |
* sudo chown k .ssh/ | |
* ssh-keygen -t rsa | |
* cat .ssh/id_rsa.pub | |
* copy and paste key into https://github.com/settings/ssh | |
* git config --global user.name "Karlgl" | |
* git config --global user.email "[email protected]" | |
Install Rails | |
* sudo apt-get install -y bundler postgresql libpq-dev | |
* sudo su postgres | |
* LC_ALL=C | |
* createuser k -d -S -R | |
Repo specific stuff | |
* git clone [email protected]:KarlGl/SmsHour.git | |
* sudo npm install gulp -g | |
* npm install | |
* nohup gulp server & | |
Static file server | |
* apt-get install -y git nginx | |
* mkdir ~/www | |
* sudo vim /etc/nginx/sites-enabled/default | |
* scroll down within 'server' after 'location / {' add these lines: | |
* root /home/k/www; | |
can add backend services in here too, so that the frontend can request them over 80 with ajax... rewrite command will not pass the "sms_hour_backend" to the app as part of its path. | |
``` | |
location /sms_hour_backend { | |
proxy_pass http://localhost:3000; | |
rewrite /sms_hour_backend/(.*) /$1 break; | |
} | |
``` | |
* save and exit vim | |
* sudo nginx -s reload | |
* now can see any files in the www folder from a web browser | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment