Выводы:
Выводы:
Выводы:
Выводы:
Выводы:
Выводы:
Выводы:
Выводы:
Выводы:
Выводы:
Выводы:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.4.23.11 netmask 255.255.255.0 broadcast 10.4.23.255
inet6 fe80::a00:27ff:fed7:e759 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:d7:e7:59 txqueuelen 1000 (Ethernet)
RX packets 200633 bytes 247164183 (247.1 MB)
RX errors 0 dropped 4685 overruns 0 frame 0
TX packets 16379 bytes 1754936 (1.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2987 bytes 171636 (171.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2987 bytes 171636 (171.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
1
ping 127.0.0.1
1
2
3
4
5
6
ping 127.0.0.1
ping 192.168.56.101
ping 192.168.56.1
ping 192.168.56.15
ping 8.8.8.8
ping ya.ru
1
2
3
4
5
nc localhost 22
SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.5
hello
Invalid SSH identification string.
^C
1
nc -z -v localhost 1-100
1
nc -l 8080
1
2
3
4
arp -n
Address HWtype HWaddress Flags Mask Iface
10.4.23.31 ether 80:6d:97:08:2d:23 C enp0s3
10.4.23.1 ether b0:fa:eb:06:b1:cc C enp0s3
1
2
3
4
5
6
sudo netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 42650/systemd-resol
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 630/sshd: /usr/sbin
tcp6 0 0 :::22
1
2
3
4
5
sudo netstat -tpn
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 10.4.23.11:22 10.4.23.31:40926 ESTABLISHED 1935/sshd: user [pr
tcp 0 0 192.168.56.101:22 192.168.56.1:36344 ESTABLISHED 15920/sshd: user [p
Выводы:
1
2
3
4
5
6
7
8
9
sudo apt update
sudo apt install apache2
systemctl status apache2
systemctl start apache2
netstat -tlpn
curl 10.4.23.11 80
sudo ufw status
sudo ufw app list
sudo ufw allow 'Apache'
1
2
3
4
5
6
openssl req -new -x509 -days 30 -keyout server.key -out server.pem
sudo a2enmod ssl
sudo a2ensite default-ssl
cd /etc/apache2/sites-available/
sudo vim default-ssl.conf
1
2
3
4
5
6
7
sudo mkdir /var/www/test.com
sudo chown -R $USER:$USER /var/www/test.com
sudo chmod -R 755 /var/www/test.com
sudo vim /var/www/test.com/index.html
sudo vim /etc/apache2/sites-available/test.com.conf
sudo a2ensite test.com.conf
sudo systemctl restart apache2
1
2
3
4
5
6
7
8
<html>
<head>
<title>Welcome to test.com!</title>
</head>
<body>
<h1>Success! The test.com virtual host is working!</h1>
</body>
</html>
1
2
3
4
5
6
7
8
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName test.com
ServerAlias www.test.com
DocumentRoot /var/www/ytest.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
1
2
3
4
5
6
sudo apt update
sudo apt install nginx
sudo ufw app list
sudo ufw allow 'Nginx Full'
sudo ufw status
systemctl status nginx
1
sudo nano /etc/nginx/sites-available/test.com
1
2
3
4
5
6
7
8
9
10
11
12
13
server {
listen 80;
listen [::]:80;
root /var/www/test.com/html;
index index.html index.htm index.nginx-debian.html;
server_name test.com www.test.com;
location / {
try_files $uri $uri/ =404;
}
}
1
2
sudo ln -s /etc/nginx/sites-available/test.com /etc/nginx/sites-enabled/
sudo systemctl restart nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {
listen 443 ssl;
listen 80;
server_name test.com;
ssl_certificate /etc/ssl/your_domain.crt;
ssl_certificate_key /etc/ssl/your_domain.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
keepalive_timeout 70;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
}