Apache server user authentication simple configuration solution set

  
                  Apache is currently the popular web server, which can run under Linux, Unix, Windows and other operating systems. It can solve the authentication problem of "username + password". The username and password required for Apache user authentication are stored in two different ways: one is a text file; the other is a database such as MSQL, Oracle, or MySQL. Let's take Linux Apache as an example. For these two storage methods, we can give a brief description of Windows Apache user authentication. Let us introduce the way to achieve through text authentication. Establishing a user's authentication and authorization requires three steps: 1. Establishing a user library 2. Configuring a server's protection domain 3. Telling the server which users have access to resources. The nonsense is not the most obvious example! ~ If a file in a directory such as /home/ftp/pub needs to be authenticated by user authentication, create a user
@htpasswd –c /*/.password xuanfei to create an authentication group
@vi /*/.groupxuanfei- Group:xuanfei xuanfei1 Basic Apache user authentication method: Add the following line 
<>options indexes followsymlinksallowoverride authconfigorder allow, denyallow from all<> or add to /etc/httpd/conf.d in httpd.conf /Create a new configuration file named .conf at the end of the .conf 
Options IndexesAllowOverride AuthConfigorder allow, denyallow from all used in the directory /home/ftp/pub to put the file .htaccess, The content is as follows: 
authname "shared files"authtype basicauthuserfile /*/.passwordrequire valid-user#require group xuanfei-group //Receive group so user #requirre user xuanfei //Receive xuanfei single user with Apache program htpasswd Generate the file /etc/.passwd, one username per line: the password is allowed to log in as long as it provides the correct username and password pair. This is for It addresses the request requires a 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 there is a firewall dedicated line to access the Internet, the address of the internal network card is 10.45.63.1/32, now it is hoped that all dialing the local 633 through the Apache reverse proxy on the firewall to the LAN Another WWW server on the access requires authentication, and users on the local LAN do not need to be authenticated. You can put it in httpd.conf: 
AuthName "shared files"AuthType BasicAuthUserFile /etc/.passwdrequire valid-usersatisfy any has different permissions on the same directory and its subdirectories. Only some people can access subdirectories under a directory. If there is a directory /home/ftp/pub/host, there are three users user1, user2, and user3 all need username and password to enter /home/ftp/pub, but only user1, user2 can enter /home/ftp/pub/host. Put the following line to httpd.conf 

Copyright © Windows knowledge All Rights Reserved