Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Apache user authentication

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

After setting up the LAMP environment and installing Discuz, how to use the user authentication function of Apache, this function will create a page only, which can only be accessed after entering the password! The command operates as follows:

Cd / data/www

Mkdir abc

Cd abc

Cp / etc/passwd. / 12.txt

Vim / usr/local/apache2/conf/extra/httpd-vhosts.conf (insert the following information before the last line)

Allowoverride AuthConfig

AuthName "Custom"

AuthType Basic

AuthUserFile / data/.htpasswd

Require valid-user

# "Custom" is the password prompt for the pop-up window of a web page

Save exit

Vim / etc/profile.d/path.sh (add the following information at the end)

: / usr/local/apache2/bin/

Save and put forward

Source / etc/profile.d/path.sh

Htpasswd-c / data/.htpasswd user1 (- c stands for creation, and again, use this command to create users without adding-caches! It will be covered! )

Cat / dat/.htpasswd

Htpasswd / data/.htpasswd user2

Cat / dat/.htpasswd

Apachectl-t

Apachectl graceful

Browse www.test.com/abc/12.txt

Vim / usr/local/apache2/conf/extra/httpd-vhosts.conf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report