Advertisement
Web Server Administration & Basic Auth

Apache & Nginx .htpasswd Generator

Create secure HTTP Basic Authentication password files using Bcrypt or SHA-1 for Apache, Nginx, and Docker containers.

Credentials Entry
Formatted .htpasswd

How to Protect Your Web Directory with .htpasswd and .htaccess

HTTP Basic Authentication provides a lightweight, server-level barrier preventing unauthorized users and search engine bots from accessing staging environments, WordPress wp-login.php paths, or internal administrative dashboards.

Frequently Asked Questions

On your web server, create a temporary PHP file named path.php containing <?php echo getcwd(); ?> and open it in your browser. This prints the exact absolute path (e.g., /var/www/vhosts/example.com/.htpasswd) to use in your AuthUserFile directive. Remember to delete the file afterwards!

In your Nginx server block or location block, specify:
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;
AI Images