-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathweb-servers.txt
100 lines (63 loc) · 2.2 KB
/
web-servers.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
# Web Servers Installation
## Topics
1. Inginx On Ubuntu 20.04
--------------------------------------------------------
>>> Inginx On Ubuntu 20.04 <<<<<
sudo apt-get update
sudo apt-get install nginx
nginx -v
sudo systemctl status nginx
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl stop nginx
sudo systemctl disable nginx
sudo systemctl reload nginx
sudo systemctl restart nginx
sudo ufw app list
sudo ufw allow 'nginx http'
sudo ufw reload
sudo ufw allow 'nginx https'
sudo ufw allow 'nginx full'
http://127.0.0.1
sudo apt-get install curl
curl –i 127.0.0.1
sudo mkdir -p /var/www/test_domain.com/html
sudo chown –R $USER:$USER /var/www/test_domain.com
sudo chmod –R 755 /var/www/test_domain.com
sudo nano /var/www/test_domain.com/html/index.html
<html>
<head>
<title>Welcome to test_domain.com!</title>
</head>
<body>
<h1>This message confirms that your Nginx server block is working. Great work!</h1>
</body>
</html>
Press CTRL+o to write the changes, then CTRL+x to exit.
sudo nano /etc/nginx/sites-available/test_domain.com
Enter the following code:
server {
listen 80;
root /var/www/test_domain.com/html;
index index.html index.htm index.nginx.debian.html;
server_name test_domain.com www.test_domain.com;
location / {
try_files $uri $uri/ =404;
}
}
sudo ln –s /etc/nginx/sites-available/test_domain.com /etc/nginx/sites-enabled
sudo systemctl restart nginx
sudo nginx –t
hostname –i
sudo nano /etc/hosts
127.0.1.1 test_domain.com www.test_domain.com
Important Nginx File Locations
By default, Nginx stores different configuration and log files in the following locations:
/var/www/html – Website content as seen by visitors.
/etc/nginx – Location of the main Nginx application files.
/etc/nginx/nginx.conf – The main Nginx configuration file.
/etc/nginx/sites-available – List of all websites configured through Nginx.
/etc/nginx/sites-enabled – List of websites actively being served by Nginx.
/var/log/nginx/access.log – Access logs tracking every request to your server.
/var/log/ngins/error.log – A log of any errors generated in Nginx.
---------------------------------------------------