Protecting a folder on nginx

15 sec read

|| how to protecting a folder with password on nginx
| generate htpasswd password using perl

# perl -le 'print crypt("yourpassword", "salt")'

| make htpasswd

# vi /etc/nginx/conf/htpasswd
username:eNcRyPtIoNpAsSwOrd:justcomment

| setup on nginx.conf / vhost

# vi /etc/nginx/nginx.conf
# add line like this
location ^~/afoldername {
        auth_basic            "Restricted";
        auth_basic_user_file  /etc/nginx/conf/htpasswd;
   }

| restarting nginx

# /etc/init.d/nginx restart

|| links
| google
| snippet

How to fix problem with…

Facing a Git error with the 'vi' editor? Discover how to easily fix it by checking your Vim path and configuring Git to use...
Sysadmin.ID
10 sec read

Apache :: MP4 Streaming

Learn how to enable MP4 streaming in Apache with the installation of the mod_h264 streaming module, making your video content accessible and efficient. Follow...
Sysadmin.ID
18 sec read

Apache :: Flash / FLV…

Learn how to effortlessly configure Apache for FLV streaming by installing the mod_flvx module and updating your httpd.conf file. Discover the simple steps to...
Sysadmin.ID
15 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *