简体   繁体   中英

.htaccess in nginx and php don't work

When I set up an .htaccess file with user and pass for .php file Nginx tries download this file instead of loading it. What can I do to make that functionality work or to replicate that functionality in Nginx

location /folder/subfolder/file.php {
    auth_basic "Administrator Login";
    auth_basic_user_file /etc/nginx/.htpasswd;
}

.htaccess is for Apache HTTP server but not for Nginx.

There is a .htaccess to Nginx converter which can convert your .htaccess settings into a format that will work with Nginx.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM