반응형
1. install ssh server
- sudo apt install openssh-server
kkeunuk-virtual-machine:~$ sudo apt install openssh-server [sudo] password for kkeunuk: Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: libflashrom1 libftdi1-2 libllvm13 Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: ncurses-term openssh-sftp-server ssh-import-id Suggested packages: molly-guard monkeysphere ssh-askpass The following NEW packages will be installed: ncurses-term openssh-server openssh-sftp-server ssh-import-id 0 upgraded, 4 newly installed, 0 to remove and 4 not upgraded. Need to get 752 kB of archives. After this operation, 6,050 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 openssh-sftp-server amd64 1:8.9p1-3ubuntu0.6 [38.7 kB] Get:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 openssh-server amd64 1:8.9p1-3ubuntu0.6 [435 kB] Get:3 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 ncurses-term all 6.3-2ubuntu0.1 [267 kB] Get:4 http://kr.archive.ubuntu.com/ubuntu jammy/main amd64 ssh-import-id all 5.11-0ubuntu1 [10.1 kB] Fetched 752 kB in 3s (264 kB/s) Preconfiguring packages ... Selecting previously unselected package openssh-sftp-server. (Reading database ... 198273 files and directories currently installed.) Preparing to unpack .../openssh-sftp-server_1%3a8.9p1-3ubuntu0.6_amd64.deb ... Unpacking openssh-sftp-server (1:8.9p1-3ubuntu0.6) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a8.9p1-3ubuntu0.6_amd64.deb ... Unpacking openssh-server (1:8.9p1-3ubuntu0.6) ... Selecting previously unselected package ncurses-term. Preparing to unpack .../ncurses-term_6.3-2ubuntu0.1_all.deb ... Unpacking ncurses-term (6.3-2ubuntu0.1) ... Selecting previously unselected package ssh-import-id. Preparing to unpack .../ssh-import-id_5.11-0ubuntu1_all.deb ... Unpacking ssh-import-id (5.11-0ubuntu1) ... Setting up openssh-sftp-server (1:8.9p1-3ubuntu0.6) ... Setting up openssh-server (1:8.9p1-3ubuntu0.6) ... Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 3072 SHA256:V7cH6xTufaU8Vz7dHYSbXCpWuSPmoQraWHkC9ouZjog root@kkeunuk-virtual-mac hine (RSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:g8LZgnXz1KEJl6Pd/mE6PgZlt8vkxbY9IugQ564WgPg root@kkeunuk-virtual-mach ine (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:Ek3lSFPoSxOVcCo1CxxuaUuLjGhk/hkrM4X+wYir8NI root@kkeunuk-virtual-mach ine (ED25519) Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.servi ce. Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/s ystemd/system/ssh.service. rescue-ssh.target is a disabled or a static unit, not starting it. ssh.socket is a disabled or a static unit, not starting it. Setting up ssh-import-id (5.11-0ubuntu1) ... Setting up ncurses-term (6.3-2ubuntu0.1) ... Processing triggers for man-db (2.10.2-1) ... Processing triggers for ufw (0.36.1-4ubuntu0.1) ... |
2. install nginx
sudo apt install nginx
kkeunuk@kkeunuk-virtual-machine:~$ sudo apt install nginx Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: libflashrom1 libftdi1-2 libllvm13 Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: libnginx-mod-http-geoip2 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libnginx-mod-stream-geoip2 nginx-common nginx-core Suggested packages: fcgiwrap nginx-doc The following NEW packages will be installed: libnginx-mod-http-geoip2 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libnginx-mod-stream-geoip2 nginx nginx-common nginx-core 0 upgraded, 9 newly installed, 0 to remove and 4 not upgraded. Need to get 697 kB of archives. After this operation, 2,395 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 nginx-common all 1.18.0-6ubuntu14.4 [40.0 kB] Get:2 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnginx-mod-http-geoip2 amd64 1.18.0-6ubuntu14.4 [11.9 kB] Get:3 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnginx-mod-http-image-filter amd64 1.18.0-6ubuntu14.4 [15.4 kB] Get:4 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnginx-mod-http-xslt-filter amd64 1.18.0-6ubuntu14.4 [13.7 kB] Get:5 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnginx-mod-mail amd64 1.18.0-6ubuntu14.4 [45.7 kB] Get:6 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnginx-mod-stream amd64 1.18.0-6ubuntu14.4 [72.9 kB] Get:7 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libnginx-mod-stream-geoip2 amd64 1.18.0-6ubuntu14.4 [10.1 kB] Get:8 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 nginx-core amd64 1.18.0-6ubuntu14.4 [484 kB] Get:9 http://kr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 nginx amd64 1.18.0-6ubuntu14.4 [3,872 B] Fetched 697 kB in 2s (289 kB/s) Preconfiguring packages ... Selecting previously unselected package nginx-common. (Reading database ... 201149 files and directories currently installed.) Preparing to unpack .../0-nginx-common_1.18.0-6ubuntu14.4_all.deb ... Unpacking nginx-common (1.18.0-6ubuntu14.4) ... Selecting previously unselected package libnginx-mod-http-geoip2. Preparing to unpack .../1-libnginx-mod-http-geoip2_1.18.0-6ubuntu14.4_amd64.deb ... Unpacking libnginx-mod-http-geoip2 (1.18.0-6ubuntu14.4) ... <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html> ...skipping... Selecting previously unselected package libnginx-mod-http-image-filter. Preparing to unpack .../2-libnginx-mod-http-image-filter_1.18.0-6ubuntu14.4_amd64.deb ... Unpacking libnginx-mod-http-image-filter (1.18.0-6ubuntu14.4) ... Selecting previously unselected package libnginx-mod-http-xslt-filter. Preparing to unpack .../3-libnginx-mod-http-xslt-filter_1.18.0-6ubuntu14.4_amd64.deb ... Unpacking libnginx-mod-http-xslt-filter (1.18.0-6ubuntu14.4) ... Selecting previously unselected package libnginx-mod-mail. Preparing to unpack .../4-libnginx-mod-mail_1.18.0-6ubuntu14.4_amd64.deb ... Unpacking libnginx-mod-mail (1.18.0-6ubuntu14.4) ... Selecting previously unselected package libnginx-mod-stream. Preparing to unpack .../5-libnginx-mod-stream_1.18.0-6ubuntu14.4_amd64.deb ... Unpacking libnginx-mod-stream (1.18.0-6ubuntu14.4) ... Selecting previously unselected package libnginx-mod-stream-geoip2. Preparing to unpack .../6-libnginx-mod-stream-geoip2_1.18.0-6ubuntu14.4_amd64.deb ... Unpacking libnginx-mod-stream-geoip2 (1.18.0-6ubuntu14.4) ... Selecting previously unselected package nginx-core. Preparing to unpack .../7-nginx-core_1.18.0-6ubuntu14.4_amd64.deb ... Unpacking nginx-core (1.18.0-6ubuntu14.4) ... <!DOCTYPE html> <html> <!DOCTYPE html> <html> <!DOCTYPE html> <html> Selecting previously unselected package nginx. Preparing to unpack .../8-nginx_1.18.0-6ubuntu14.4_amd64.deb ... Unpacking nginx (1.18.0-6ubuntu14.4) ... Setting up nginx-common (1.18.0-6ubuntu14.4) ... Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service. Setting up libnginx-mod-http-xslt-filter (1.18.0-6ubuntu14.4) ... Setting up libnginx-mod-http-geoip2 (1.18.0-6ubuntu14.4) ... Setting up libnginx-mod-mail (1.18.0-6ubuntu14.4) ... Setting up libnginx-mod-http-image-filter (1.18.0-6ubuntu14.4) ... Setting up libnginx-mod-stream (1.18.0-6ubuntu14.4) ... Setting up libnginx-mod-stream-geoip2 (1.18.0-6ubuntu14.4) ... Setting up nginx-core (1.18.0-6ubuntu14.4) ... * Upgrading binary nginx [ OK ] Setting up nginx (1.18.0-6ubuntu14.4) ... Processing triggers for man-db (2.10.2-1) ... Processing triggers for ufw (0.36.1-4ubuntu0.1) .. |
3. IP address
kkeunuk@kkeunuk-virtual-machine:~$ ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:0a:0a:cb brd ff:ff:ff:ff:ff:ff altname enp2s1 inet 172.16.127.131/24 brd 172.16.127.255 scope global dynamic noprefixroute ens33 valid_lft 1606sec preferred_lft 1606sec inet6 fe80::80bb:c106:98d7:d1db/64 scope link noprefixroute valid_lft forever preferred_lft forever |
4.
kkeunuk@kkeunuk-virtual-machine:/var/www/html$ pwd
/var/www/html
kkeunuk@kkeunuk-virtual-machine:/var/www/html$ less index.html
<!DOCTYPE html> <html> <h1>Welcome to My Web Server</h1> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Get Client IP</title> </head> <body> <script> // 클라이언트의 IP 주소를 얻는 함수 function getClientIP(callback) { // 외부 서비스를 이용하여 클라이언트의 IP 주소 가져오기 fetch('https://api64.ipify.org?format=json') .then(response => response.json()) .then(data => { const clientIP = data.ip; callback(clientIP); }) .catch(error => { console.error('Error fetching IP address:', error); callback(null); }); } // 페이지 로딩이 완료된 후에 클라이언트의 IP를 출력 window.onload = function() { getClientIP(function(ip) { const ipElement = document.getElementById('clientIP'); if (ip) { ipElement.textContent = 'Your IP Address: ' + ip; } else { ipElement.textContent = 'Failed to retrieve IP address.'; } }); }; </script> <p id="clientIP">Loading...</p> <script> // 3초 간격으로 페이지 자동 refresh setInterval(function() { location.reload(); }, 3000); </script> |
반응형
'IT' 카테고리의 다른 글
Random MAC address (1) | 2024.02.28 |
---|---|
Take configure for Loadbalancer on Ubuntu (0) | 2024.02.03 |
Describe shared-tree / shortest path on Multicast Routing (0) | 2024.01.30 |
Regarding IKEv2 , How toTroubleshooting (0) | 2024.01.21 |
Analysis releate to IPSEC VPN (0) | 2023.12.13 |