Apache Server Introduction user authentication simple configuration scheme set

Source: Internet
Author: User
Tags ftp require valid firewall linux

Apache is the current popular Web server, can run in Linux, Unix, Windows and other operating systems, it can well solve the "username + password" authentication problem. The user name and password required for Apache authentication are stored in two different ways: one is a text file and the other is a database of mSQL, Oracle, and MySQL. The following is an example of the Linux Apache, which provides a brief description of the Apache user authentication for Windows in both of these storage modes. Let's introduce the way to achieve this through the text authentication.

It takes three steps to establish a user's authentication authority:

1, the establishment of user library

2, configure the server protection domain

3, tell the server which users have access to resources

Nonsense not many examples most clearly pull! ~ If a directory of documents such as/home/ftp/pub need to do user authentication

To create an authenticated user

@htpasswd –c /*/.password xuanfei

Create an authentication group

@vi /*/.group
xuanfei-group:xuanfei xuanfei1

Basic Apache user authentication method:

Add the following line to the httpd.conf

<>
options indexes followsymlinks
allowoverride authconfig
order allow,deny
allow from all
<>

or add to/etc/httpd/conf.d/a new profile with a. conf End file name

〈Directory /home/ftp/pub>
Options Indexes
AllowOverride AuthConfig
order allow,deny
allow from all
〈/Directory>

Used in the directory/home/ftp/pub decentralized files. htaccess, the contents are as follows:

authname "shared files"
authtype basic
authuserfile /*/.password
require valid-user
#require group xuanfei-group //接收组所以用户
#requirre user xuanfei //接收xuanfei单个用户

Generate file/etc/.passwd with a program htpasswd with Apache, one user name per line: password

Access is allowed as long as the correct username and password pair are available, which is for any address

Requests are required to provide user name and password authentication.

Authentication is required for some network segments or addresses.

If the network segment of the company LAN is 10.45.63.0/24, and a firewall line is connected to the Internet,

Internal network card address for 10.45.63.1/32, then now want all by dialing local 633 through

The Apache reverse proxy on the firewall needs authentication when it accesses another WWW server on the LAN, while the local

Users on the LAN are not required to authenticate. Can be placed in the httpd.conf:

〈Directory /home/ftp/pub>
Options Indexes FollowSymLinks
AllowOverride AuthConfig
order deny,allow
deny from 10.45.63.1
〈/Directory>

And put in the/home/ftp/pub/.htaccess:

AuthName "shared files"
AuthType Basic
AuthUserFile /etc/.passwd
require valid-user
satisfy any

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.