-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfiguration.txt
139 lines (106 loc) · 3.19 KB
/
configuration.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
=============
NGINX Install
sudo apt-get update
sudo apt-get install nginx
sudo ufw app list
sudo ufw enable
sudo ufw allow 'Nginx Full'
sudo ufw allow 'OpenSSH'
sudo ufw allow 'Nginx HTTP'
sudo ufw status
systemctl status nginx
==============
sudo chown -R ubuntu /var/www/html
sudo chmod 755 -R /var/www/html
Laravel root dir-
sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache
chmod -R 775 storage
chmod -R 775 bootstrap/cache
==============
NodeJs Install
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
#nano nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
===========
PM2 Install
sudo npm install pm2@latest -g
Run App using PM2
npm run build #in project dir
pm2 start npm -- start
pm2 startup systemd
pm2 save
# run Environment=PATH= url form above list
pm2 reload all #for restart
=====================
Nginx configuration
/etc/nginx/sites-available/default
`
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html/nestjsapp/dist;
server_name DOMAIN;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:3000;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}
}
`
sudo nginx -t
sudo systemctl restart nginx
sudo systemctl reload nginx
===================
PostgreSQL Install
sudo apt-get install postgresql postgresql-contrib postgresql-client
sudo systemctl start postgresql
sudo systemctl enable postgresql
#switch to postgre user
sudo -i -u postgres
createdb db_name
#or
sudo -u postgres createdb db_name
sudo -u postgres psql -c "ALTER postgres PASSWORD 'postgres';"
sudo ufw allow 5432/tcp #for remote access in pgadmin
==============================================
For redeploy updates copy src folder and paste
npm run build #in project dir
pm2 reload all #for restart
==============================================
MySQL Install
sudo apt-get update
sudo apt-get install mysql-server
systemctl status mysql
mysql_secure_installation
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf #comment bind-address in this file
require_secure_transport = on #add below bind-address
sudo mysql_ssl_rsa_setup --uid=mysql #For SSL run this command
sudo systemctl restart mysql
sudo ufw allow mysql
==============================================
MySQL SetUp
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;
CREATE USER 'username'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
==============================================
PHP Setup
7.2
sudo apt-get install php-fpm
systemctl status php7.2-fpm
sudo apt-get install php7.2-mysql
7.3
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php7.3 php7.3-common php7.3-opcache php7.3-cli php7.3-gd php7.3-curl php7.3-mysql
==============================================
delete files and folders
in folder- sudo rm -r *
chmod 400 privatekey.pem