NGINX Password Protect website

  • I have created .htaccess and .htpasswd files and put them in my root web root directory (above the directory of the web site I want to project) but it appears there is something else I need to configure? I also tried putting the files in the web site's directory itself, but still no joy. Can someone coach me on what I would type into the webui of OMV for this Nginx site?

  • nginx doesn't use .htaccess and .htpasswd. That is an apache feature. I would run your site in docker using an apache image.

    omv 5.5.11 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.3.6 plugins source code and issue tracker - github

    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • Thanks! Actually, your comment gave me the idea I needed to research ngnix and found the solution. Using the OMV Gui, under Services/Ngnix/Servers, select the web site you want to password protect. Then click Edit, and at the bottom there is a box for "Extra options". In that box add (without the numbers):

    auth_basic "Administrator Login";
    auth_basic_user_file /srv/dev-disk-by-label-4TB/Public/WebSite/.htpasswd;

    but replace the 'srv/dev..../Public/WebSite/' with whatever your location is for your website folders. Use the normal method of creating the .htpasswd file, and place it in the MAIN directory of your websites (NOT in the website directory itself). Working perfectly for me!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!