:e ~/article/protect-your-apache-directory.md [readonly]

smjrifle@smjrifle.xyz:~/article/ $

Protect your Apache directory

We can use htpasswd to keep unauthorized users from visiting a directory on your server. Most cPanel interfaces allow this feature, but if you don’t have cPanel but you have SSH login, you can use it to password protect your directory.

1. Create the password file:<br>
htpasswd -c /etc/apache2/.htpasswd username

2. Add to your Apache config or .htaccess:
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user

3. Restart Apache:
sudo service apache2 restart
[:bp] Mount LVM partition on Ubuntu [:bn] Set up virtual host and integrate git with auto pull
-- NORMAL -- protect-your-apache-directory.md PHP UTF-8 0% smjrifle@xyz