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 Live24u.com – 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!.

Also Read :   Laravel 5.4 Paypal integration - Paypal Payment Gateway




Generally here given to the:On ubuntu OS system

nginx config file location

/etc/nginx/sites-available/default

Web-application or site root location default

/usr/share/nginx/www/live24u.com/

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/live24u.com/.htpasswd admin_user
sudo htpasswd  /usr/share/nginx/www/live24u.com/.htpasswd 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/live24u.com/.htpasswd;

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

Also Read :   PHP E-Commerce Shopping Cart Application step by step

location / {
    #some other configurations…
    auth_basic "Restricted Area”;                               
    auth_basic_user_file /usr/share/nginx/www/live24u.com/.htpasswd;
}

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

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





Example

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(live24u.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(live24u.com) Are Most Always Welcome.