└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Terminal Commands for fullstack course 2 | 3 | Saas template 4 | https://github.com/Saas-Starter-Kit/Saas-Kit-prisma 5 | 6 | 7 | ## install commands 8 | 9 | `sudo amazon-linux-extras install nginx1.12`: install nginx 10 | 11 | `sudo amazon-linux-extras install postgresql9.6`: install psql 12 | 13 | `sudo yum install git`: install git 14 | 15 | `sudo curl https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash`: install nvm 16 | 17 | `npm install pm2 -g`: install pm2 globally 18 | 19 | 20 | ## Basic commands 21 | `sudo nano`: The text editor used in the Linux AMI 2. 22 | 23 | `sudo rm name-of-directory`: remove directory 24 | 25 | `cd name-of-directory`: change to directory 26 | 27 | `ssh i- “keypair.pem” ec2-user@public-ip-address`: ssh into linux instance. 28 | 29 | `sudo chmod 777`: give all permissions to directory 30 | 31 | `ls`: list files and folders in pwd 32 | 33 | `pwd`: present working directory 34 | 35 | `psql -d name-of-db -h host-name -p port -U username`: how to connect to the psql database 36 | 37 | 38 | ## npm/node commands 39 | `node -v`: node version 40 | 41 | `npm -v`: npm version 42 | 43 | `nvm -v`: node version manager version 44 | 45 | `nvm ls remote`: node versions available for download 46 | 47 | `nvm install version-of-node`: install node 48 | 49 | 50 | ## pm2 commands 51 | 52 | 53 | `pm2 list`: list all running processes 54 | 55 | `pm2 stop app 0`: stop app with id 0 56 | 57 | `pm2 delete app 0`: delete app with id 0 58 | 59 | `pm2 restart app 0`: restart app with id 0 60 | 61 | `pm2 start app.js -i max`: start app.js with max number of threads available 62 | 63 | 64 | ## nginx commands 65 | 66 | `sudo systemctl restart nginx`: Restart nginx. After you modify the nginx.conf file you will need to restart nginx using this command otherwise your updates will not take place 67 | 68 | `sudo nano nginx.conf`: edit nginx file 69 | 70 | `cd /etc/nginx`: cd into nginx directory 71 | 72 | `sudo nano /var/log/nginx/error.log`: access error log 73 | 74 | `sudo nginx -t`: test nginx 75 | 76 | ``` 77 | server { 78 | listen 80 default_server; 79 | listen [::]:80 default_server; 80 | server_name localhost; 81 | 82 | 83 | # Load configuration files for the default server block. 84 | include /etc/nginx/default.d/*.conf; 85 | 86 | location / { 87 | root /react-prod5/build; 88 | index index.html; 89 | try_files $uri /index.html; 90 | 91 | } 92 | 93 | location /api/ { 94 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 95 | proxy_set_header Host $http_host; 96 | proxy_set_header X-NginX-Proxy true; 97 | proxy_pass http://10.0.1.187:3000; 98 | proxy_http_version 1.1; 99 | proxy_set_header Upgrade $http_upgrade; 100 | proxy_set_header Connection 'upgrade'; 101 | proxy_set_header Host $host; 102 | proxy_cache_bypass $http_upgrade; 103 | 104 | } 105 | ``` 106 | --------------------------------------------------------------------------------