Add a web access password for a Linux Server

Source: Internet
Author: User
// 1. httpd in the Apache server of the website. the conf file is set to DocumentRoot/var/www/html // This path is the default folder path opened when the external IP address of the Linux server is set in Apache. It must be the complete path accessfilename. htaccessallowoverride all // 2, Linux Command htpasswd-C allowuser /. htpasswd newuser // create in the allowuser folder under the current directory. create a newuser user in the htpasswd file, and then prompt to set the password .. Put the htpasswd file in a folder under/var/www/instead of/var/www/html to prevent users who can access the HTML folder from modifying its content. // 3, add it to the folder to be accessed (the folder must be under the/var/www/html path or the/var/www/html path itself. and write authname "section name" authtype basicauthuserfile/var/www/allowuser /. htpasswd // enter the one you just created. the complete path of the htpasswd file is require valid-user // 4, and the file is finally set. htpasswd and. make sure that the Apache user has the read permission for the htaccess file. Therefore, the permission is required when accessing the webpage under this folder. username and password in the htpasswd File

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.