If you're using Nginx, you can set up basic authentication using a similar approach:
printf "username:$(openssl passwd -crypt password)\n" >> /etc/nginx/.htpasswd
Replace username and password with your credentials
username
password
2. Edit your Nginx configuration file to include the authentication for the specific URL:
location /protected-url/ { auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd;}
Replace /protected-url/ with the specific path you want to protect.
/protected-url/
3. Reload Nginx:
sudo service nginx reload
4. Test the URL to verify the password protection is in place.