Apache user authentication

Source: Internet
Author: User

Apache user authentication

Sometimes, we need to give some special access to set up a user authentication mechanism to increase security. For example, we have just installed the Discuz forum, there is a management background, although the management of the background itself has a password, but we in order to be more secure, you can set a level of user authentication.

#vim/usr/local/apache2/conf/extra/httpd-vhosts.conf

In the corresponding virtual host configuration, add the following configuration:

<Directory/data/www/ab>//Specify the path, which directory needs to be restricted

AllowOverride authconfig

AuthName "Custom"

AuthType Basic

authuserfile/data/. htpasswd

Require Valid-user

</Directory>

Description : First specify which directory to validate, AuthName custom, authuserfile specify where the user password file is.

Enter the profile character longer, so develop a path

[Email protected] abc]# vim/etc/profile.d/path.sh

#! /bin/bash

Export path= $PATH:/usr/local/mysql/bin//config file

Add directly behind the bin: Usr/local/apache2/bin

After saving exits

[Email protected] abc]# source/etc/profile.d/path.sh

[Email protected] abc]#/USR/LOCAL/APACHE2/BIN/HTPASSWD-CM/DATA/.HTPASSWD user1

New Password:

Re-type New Password:

Adding Password for user user1

This step is to create the user to authenticate, the first time to add a-c option, the purpose is to create

/data/.htpasswd password file, enter the password you want to set is OK.

Then restart the Apache service

[Email protected] abc]#/usr/local/apache2/bin/apachectl-t

Check that the configuration is correct first

[Email protected] abc]#/usr/local/apache2/bin/apachectl Graceful

Here with graceful equivalent is the reload configuration.


This article from "12350027" blog, declined reprint!

Apache user authentication

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.