Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. 1. sudo apt update
  2.  
  3. 2. sudo apt install apache2
  4.  
  5. 3. sudo systemctl status apache2
  6.  
  7. Output
  8. ```
  9. ● apache2.service - The Apache HTTP Server
  10. Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  11. Active: active (running) since Wed 2018-09-05 19:21:48 UTC; 13min ago
  12. Main PID: 12849 (apache2)
  13. CGroup: /system.slice/apache2.service
  14. ├─12849 /usr/sbin/apache2 -k start
  15. ├─12850 /usr/sbin/apache2 -k start
  16. └─12852 /usr/sbin/apache2 -k start
  17.  
  18. Sep 05 19:21:48 apache systemd[1]: Starting The Apache HTTP Server...
  19. Sep 05 19:21:48 apache systemd[1]: Started The Apache HTTP Server.
  20. ```
  21.  
  22. 4. `sudo apt install curl`
  23.  
  24. jeśli wyskoczy ci to:
  25.  
  26. ```
  27. Media change: please insert the disc labeled
  28. 'Debian GNU/Linux 10.1.0 _Buster_ - Official amd64 DVD Binary-1 20190908-01:09'
  29. in the drive '/media/cdrom/' and press [Enter]
  30. ```
  31. wisz komende: `sudo sed -i '/cdrom/d' /etc/apt/sources.list` i jeszcze raz spróbuj
  32.  
  33. 5. hostname -I
  34. To da ci adres IP
  35.  
  36.  
  37. 6. `http://your_server_ip` <-tutaj wpisujesz swoj adres IP z poprzedniej komendy zamiast `your_server_ip`
  38.  
  39. 7. `cd /var/www/html`
  40.  
  41. 8. `rm -rf index.html `
  42.  
  43. 9. `touch index.html` - to załatwia punkt modyfikacji pliku XD (wpisz tam w tympliku jakikolwiek
  44. napis xd bedziesz mial go na stronie)
  45.  
  46. 10. `mkdir data` <- utworz katalog dla ktorego chcesz miec haslo XD
  47.  
  48. 11. `cd data`
  49.  
  50. 12. `touch index.html` twoj plik ktory sie wyswietli w tym katalogu jak wejdziesz na stronie `http://your_server_ip/data`
  51.  
  52. 13. `sudo touch .htaccess`
  53. Wpisujesz do niego
  54.  
  55. ```
  56. AuthName "Username and password required"
  57. AuthUserFile /var/www/html/data/.htpasswd
  58. Require valid-user
  59. AuthType Basic
  60. ```
  61.  
  62. 14. Zapisujesz i tworzysz w tym samym folderze plik `sudo touch .htpasswd` i wpisujesz do niego
  63. ```
  64. user:$apr1$5v7DheeI$4lfUhejTm.lsqq9qD0Hyi/
  65. ```
  66. To sprawi ze bedziesz mogl sie zalogowac do tego katalogu za pomoca loginu `user` i hasla `admin`
  67.  
  68. 15. Teraz restartujesz apache `sudo service apache2 restart`
  69.  
  70. 16. Sprawdzasz czy działa wchodzac na tą strone i do katalogu `data` czyli kolejno:
  71. - `http://your_server_ip`
  72. - `http://your_server_ip/data`
  73.  
  74. 17. Zaliczasz to zadanie! Brawo!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement