-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathCommands.txt
More file actions
106 lines (75 loc) · 3.37 KB
/
Commands.txt
File metadata and controls
106 lines (75 loc) · 3.37 KB
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
# Configure SSH Access
sudo -u your-username mkdir -p /home/your-username/.ssh
sudo -u your-username chmod 700 /home/your-username/.ssh
sudo chown -R your-username:your-username /home/your-username/.ssh
sudo -u your-username touch /home/your-username/.ssh/authorized_keys
sudo -u your-username chmod 600 /home/your-username/.ssh/authorized_keys
sudo chmod 755 /home/your-username
sudo chown your-username:your-username /home/your-username
// Create SUDO User
adduser username
usermod -aG sudo username
// Generate SSH Key Pair
ssh-keygen -t ecdsa -b 521
// Install PHP and Extensions
sudo apt update
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.3-cli
sudo apt install php8.3-common php8.3-bcmath php8.3-mbstring php8.3-xml php8.3-curl php8.3-gd php8.3-zip php8.3-mysql
// Check PHP installed modules
php8.3 -m
// Install Composer
sudo apt install composer
// Install MySQL/Secure Installation
sudo apt install mysql-server
sudo mysql_secure_installation
// Setup Database and User
CREATE DATABASE yourdatabase;
CREATE USER 'your-username'@'localhost' IDENTIFIED BY 'your-password';
GRANT ALL PRIVILEGES ON yourdatabase.* TO 'your-username'@'localhost';
FLUSH PRIVILEGES;
EXIT;
// Install NVM/NodeJS
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm --version
nvm install --lts
// Taking directory ownership
sudo chown -R username /directory-name
// Taking file ownership
sudo chown username filename
// Proper Directory Permissions (Navigate to your project root directory)
sudo chown -R $USER:www-data .
sudo find . -type f -exec chmod 664 {} \;
sudo find . -type d -exec chmod 775 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
// Install Nginx Server and Configure Virtual Host aka Server Blocks:
sudo apt install nginx
// Configure Server Blocks for your website in Nginx.
// Navigate to the directory /etc/nginx/sites-available to create a server block file.
cd /etc/nginx/sites-available
sudo vim example.com # Replace the example.com with your website or web app domain.
// Go to laravel.com, search for nginx site configuration, scroll down, copy the server configuration code, and paste it into the vim server block file.
// Replace the server_name which is example.com with your site domain
// Replace the root path /srv/example.com/public with your site Laravel public directory path.
# note: Scroll down in the same vim file and look for php-fpm which should match the PHP version installed on your server where the app is deployed.
//Save the file and exit it from vim.
// Now create a symbolic link for the server block that we just created.
cd /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled # Replace the example.com with the domain name for which we just created a server block.
// Test the nginx server for any issues or errors.
sudo nginx -t
// Restart the nginx server and then access your website or web app
sudo systemctl restart nginx
// Install Certbot
sudo apt install certbot python3-certbot-nginx
// Issue SSL Cert
sudo certbot --nginx -d glennraya.com
// SSH Config file (keep ssh-agent active)
User git
Hostname github.com
IdentityFile ~/.ssh/id_github
TCPKeepAlive yes
IdentitiesOnly yes
ServerAliveInterval 60