The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith’s tutorial and have NGINX running with certbot for certificates.
Create a username and password for authentication (or more than 1 user) First:"/>
<divclass="post-content"><p>Here’s how to only allow authenticated users to view your websites - great way to boot freeloaders and guarantee your system’s (<em>or your vps’</em>) resources for yourself.</p>
<p>The guide is meant for debian but can be easily adapted to suit your needs. I assume you have followed Luke Smith’s tutorial and have NGINX running with certbot for certificates.</p>
<h2id="create-a-username-and-password-for-authentication-or-more-than-1-user">Create a username and password for authentication (<em>or more than 1 user</em>)<ahiddenclass="anchor"aria-hidden="true"href="#create-a-username-and-password-for-authentication-or-more-than-1-user">#</a></h2>
<p>Then provide a new password (the same password can also work but it’s more secure that way).</p>
<h2id="add-the-htpasswd-file-to-nginx">Add the <code>htpasswd</code> file to NGINX<ahiddenclass="anchor"aria-hidden="true"href="#add-the-htpasswd-file-to-nginx">#</a></h2>
<p>Navigate to the NGINX configuration file you wish to protect:</p>
<ahref="/articles/blog/block-and-filter-spam-requests-with-user-agents-in-nginx/"><divid="prevart"><i>Previous:</i><br>Block and Filter Spam Requests With User-Agents in Nginx</div></a>
</div>
<div>
</div>
</article>
</main>
<footerstyle="padding-top: 0.5em;">
<divstyle="padding-bottom: 0.2em; display: inline-block;"><ahref="https://vodoraslo.xyz/articles"title="List of all my articles and writings.">📜 Articles</a><strong>•</strong><ahref="https://vodoraslo.xyz/library"title="My personal library.">📚 Library</a><strong>•</strong><ahref="https://wiki.vodoraslo.xyz"title="My personal Wiki page.">🌐 Wiki</a><strong>•</strong><ahref="https://vodoraslo.xyz/index.xml"title="Subscribe via RSS for updates.">📰 RSS</a><hr></div>
<divstyle="padding-bottom: 0.7em;"class="index-links"><ahref="https://vodoraslo.xyz/"title="Return to the homepage.">🏠 Homepage</a></div>