Apache httpd and Nginx Web Server
Apache httpd
/etc/httpd/conf/httpd.conf
AddDefaultCharset UTF-8 IndexOptions +Charset=UTF-8
Enable list of files on directory.
<Directory "/var/www/html/assets/tmp"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
Implementing basic authentication.
sudo htpasswd -c /etc/httpd/.htpasswd sakura
<Directory "/var/www/html"> AllowOverride None AuthName "sakura" AuthType Basic AuthUserFile /etc/httpd/conf/.htpasswd Require valid-user </Directory>
Nginx
sudo apt updatesudo apt install nginxsudo mkdir /var/www/tutorialsudo bash -c "cat >/var/www/tutorial/index.html" <<EOF <!doctype html> <html> <head> <meta charset="utf-8"> <title>Hello, Nginx!</title> </head> <body> <h1>Hello, Nginx!</h1> <p>We have just configured our Nginx web server on Ubuntu Server!</p> </body> </html> EOF sudo bash -c "cat >/etc/nginx/sites-enabled/tutorial" <<EOF server { listen 81; listen [::]:81; server_name example.ubuntu.com; root /var/www/tutorial; index index.html; location / { try_files $uri $uri/ =404; } } EOF sudo systemctl restart nginx
Implementing basic authentication.
~]$ sudo apt install apache2-utils ~]$ sudo htpasswd -c /etc/nginx/.htpasswd sakura New password: Re-type new password: Adding password for user sakura ~]$ sudo vi /etc/nginx/sites-enabled/tutorial server { ..... ..... location / { auth_basic "Basic Auth" ; auth_basic_user_file "/etc/nginx/.htpasswd" ; } ~]$ sudo nginx -t ~]$ sudo nginx -s reload