In the window, Apache uses authentication

Source: Internet
Author: User
Set Apache directory access authentication (Directory Access Control) in Windows XP)

1. Edit httpd. conf
Join
Alias/picture/"E:/picture /"
# Set the virtual directory picture to the root directory
<Directory "E:/picture/">;
Options indexes Multiviews
AllowOverride authconfig
Order deny, allow
Allow from all
Options all
AllowOverride all
</Directory>;
2. Create a. htaccess file under E:/picture /.
Authtype basic
Authname "login to fanxing"
Authuserfile E:/picture/. htpasswd (note that this parameter is "/")
Require valid-user
3. Create a password file under E:/picture/
1. plaintext password:
Create pass.txt
Content format: Username: Password
Before the colon, It is the username, followed by the password, which can be placed in another directory. The directory of authuserfile In the second directory must also be changed accordingly.
2. Create an MD5 encrypted password file
Enter the bin directory under your Apache directory under virtual DOS and enter the command
Htpasswd-c e: "picture". htpasswd fanxing
Next, you must enter the password twice.
The command line above indicates creating a password under E:/picture/. htpasswd
. Now restart Apache and access picture in IE. the user name and password are required!

How is the. htaccess file generated in windows.

Method 1:
You can create a text file a.txt, as long as the content is
Authtype basic
Authname "login to fanxing"
Authuserfile E:/picture/. htpasswd
Require valid-user
Then, change the file to. htaccess.
Set Folder Options to view, hide the hook of a known file extension, and rename a.txt to. htaccess.
To use the ftpclient tool, you can directly view your directory, find a.txt, and rename it as. htaccess.
Method 2: Use ultraedit32
Edit content
Authtype basic
Authname "login to fanxing"
Authuserfile E:/picture/. htpasswd
Require valid-user
Save as. htaccess
Method 3:
Enter E:/picture under virtual DOS
Enter edit. htaccess.
In the blue edit window, enter
Authtype basic
Authname "login to fanxing"
Authuserfile E:/picture/. htpasswd
Require valid-user
Save the file and A. htaccess file will appear under E:/picture.
OK. Now you should understand it!

Restrict and allow access from specific IP addresses in Apache
2007-02-15 14: 39 options all
AllowOverride none
Order deny, allow (note that the order of values of allow and deny is the same as that of upper and lower columns)
Deny from all
Allow from 192.168.0
Allow from 127.0.0.1

The above section indicates that only users in the fields 192.168.0 and 127.0.1 can access the files under the D:/WWW directory.

The following section is opposite to the above section. Access from users in the fields 192.168.0 and 127.0.1 is prohibited.

Options all
AllowOverride none
Order allow, deny (note that the order of values of allow and deny is the same as that of upper and lower columns)
Allow from all
Deny from 192.168.0
Deny from 127.0.0.1

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.