Password Protecting Website running on NGinx serve PHP-FPM

Password Protecting Website running on NGinx serve PHP-FPM

In this Post We Will Explain About is Password Protecting Website running on NGinx serve PHP-FPM With Example and Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to php – Password protect sub-folder of wordpress website on NginxExample

In this post we will show you Best way to implement How To Set Up Password Authentication with Nginx, hear for How to protect a directory with user and password on Nginxwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Generally here given to the:On ubuntu OS system

nginx config file location


Web-application or site root location default


htpasswd like as a simple is installed, if not, do

sudo apt-get install apache2-utils

1. Create some users and passwords here

sudo htpasswd -c /usr/share/nginx/www/ admin_user
sudo htpasswd  /usr/share/nginx/www/ admin_user2

2. Put these to some source commands the nginx config file

auth_basic "Restricted Area”;
auth_basic_user_file /usr/share/nginx/www/;

Some example, if the simple global or config file is /etc/nginx/sites-available/default, path here and then open it

vim /etc/nginx/sites-available/default

Find the some “location /“ and Put these two some lines like As a

location / {
    #some other configurations…
    auth_basic "Restricted Area”;                               
    auth_basic_user_file /usr/share/nginx/www/;

3. simple Reload nginx connect configuration and some time to restart nginx

sudo /etc/init.d/nginx reload
sudo service php5-fpm restart


I hope you have Got What is How to password protect a directory with HTTP Authentication in Nginx And how it works.I would Like to have FeadBack From My Blog( readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article( Are Most Always Welcome.