国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 php手冊 Apache用戶認(rèn)證方法匯總 (轉(zhuǎn)載)

Apache用戶認(rèn)證方法匯總 (轉(zhuǎn)載)

Jun 21, 2016 am 09:12 AM
directory ftp home

apache

Apache用戶認(rèn)證方法匯總

一.基本的Apache用戶認(rèn)證方法:

若對某一目錄下的文件如/home/ftp/pub需要做到用戶認(rèn)證,則在httpd.conf中加入下面的行

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


用在目錄/home/ftp/pub下放文件.htaccess,內(nèi)容如下:
authname "shared files"
authtype basic
authuserfile /etc/.passwd
require valid-user

用隨Apache來的程序htpasswd 生成文件/etc/.passwd,每行一個用戶名:密碼

只要能提供正確的用戶名和密碼對,就允許登錄訪問,這是針對任何地址來的請求都要求提供用戶名和密碼認(rèn)證。

二.針對部分網(wǎng)段或地址要求認(rèn)證。

若公司LAN所在網(wǎng)段為192.168.0.0/24,且有一防火墻專線接入Internet,內(nèi)部網(wǎng)卡的地址為192.168.0.1/32,則現(xiàn)在希望所有通過撥本地163通過防火墻上的apache反向代理向LAN上的另一WWW服務(wù)器訪問時需要認(rèn)證,而本地LAN上的用戶不需認(rèn)證??梢栽趆ttpd.conf中放入:
〈Directory /home/ftp/pub>
Options Indexes FollowSymLinks
AllowOverride AuthConfig
order deny,allow
deny from 192.168.0.1
〈/Directory>

且在/home/ftp/pub/.htaccess中放入:
AuthName "shared files"
AuthType Basic
AuthUserFile /etc/.passwd
require valid-user
satisfy any

三.對同一目錄及其下的子目錄有不同的權(quán)限,僅某些人可以存取一目錄下的子目錄。
如有一目錄/home/ftp/pub/sales,有三個用戶user1,user2,user3都需要用戶名和密碼進(jìn)入/home/ftp/pub,但僅user1,user2能進(jìn)入/home/ftp/pub/sales.則放下面的行到httpd.conf

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

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

且看/home/ftp/pub/.htaccess為:
AuthName "shared files"
AuthType Basic
AuthUserFile /etc/.passwd
require valid-user

且看/home/ftp/pub/sales/.htaccess
AuthName "shared files"
AuthType Basic
AuthUserFile /etc/.passwd
AuthGroupFile /etc/.salesgroup
require group manager

且文件/etc/.passwd內(nèi)容為:
user1:passwd1
user2:passwd2
user3:passwd3

且文件/etc/.salesgroup內(nèi)容為:
manager: user1 user2



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Active Directory Users and Computers Missing [Fixed in 3 Ways] Active Directory Users and Computers Missing [Fixed in 3 Ways] Apr 20, 2023 pm 01:25 PM

Active Directory Users and Computers (ADUC) loss is one of the most frustrating issues reported by many Windows Pro users. ADUC is an incredible MMC snap-in that enables administrators to manage Microsoft Active Directory. However, for some reason it is missing in the Windows Server or Enterprise/Pro editions. Let’s take a closer look at why it’s missing and how we can fix it. Does Windows 11 have Active Directory? Active Directory is useful for anyone wanting to manage remote

How to set up nginx reverse proxy ftp server How to set up nginx reverse proxy ftp server May 17, 2023 am 09:31 AM

1. Install nginx 2. Install vsftpd 3. Modify the nginx configuration file nginx.conf 3.1 Add the ftp user userftpuser in the first line; 3.2 Configure the relevant path server{ listen80; #nginx proxy port server_namelocalhost; #ftp server address location/images{root /home/ftpuser; #The absolute path of the folder of the proxy ftp server indexftpuser; #Set the welcome page

Using FTP in Go: A Complete Guide Using FTP in Go: A Complete Guide Jun 17, 2023 pm 06:31 PM

With the rapid development of the Internet, File Transfer Protocol (FTP) has always been an important file transfer method. In Go language, using FTP to transfer files may be a need of many developers. However, maybe many people don't know how to use FTP in Go language. In this article, we will explore how to use FTP in Go language, from connecting to FTP server to file transfer, and how to handle errors and exceptions. Create FTP connection In Go language, we can use the standard "net" package to connect to FTP

How to add/delete FTP users and set permissions in Linux How to add/delete FTP users and set permissions in Linux May 12, 2023 pm 08:46 PM

1. Environment: ftp is vsftp. The username is set to test. The restricted path is /home/test2. Create a user: under the root user: useradd-d/home/testtest#Add user test, and set the home directory of the test user to /home/testpasswdtest#Set a password for the test user3. Change the corresponding permission settings of the user: 1.usermod-s/sbin/nologintest#Limit user test cannot telnet, only ftp2.usermod-s/bin/bashtest#Return to normal for user test 3.usermod-d

PHP and FTP: realizing file sharing among multiple departments in website development PHP and FTP: realizing file sharing among multiple departments in website development Jul 28, 2023 pm 01:01 PM

PHP and FTP: Achieve file sharing among multiple departments in website development. With the development of the Internet, more and more companies are beginning to use website platforms for information release and business promotion. However, the problem that arises is how to achieve file sharing and collaboration among multiple departments. In this case, PHP and FTP become one of the most commonly used solutions. This article will introduce how to use PHP and FTP to achieve file sharing among multiple departments in website development. 1. Introduction to FTP FTP (FileTransferPr

What are the ftp commands under linux? What are the ftp commands under linux? Mar 21, 2023 am 09:59 AM

The ftp commands under Linux include: 1. ftp command; 2. close command; 3. disconnect command; 4. open command; 5. user command; 6. account command; 7. bye command; 8. quit command; 9. help command ;10. rhelp command; 11. ascii command; 12. binary/bi command; 13. bell command, etc.

How to implement FTP file upload progress bar using PHP How to implement FTP file upload progress bar using PHP Jul 30, 2023 pm 06:51 PM

How to use PHP to implement FTP file upload progress bar 1. Background introduction In website development, file upload is a common function. For the upload of large files, in order to improve the user experience, we often need to display an upload progress bar to the user to let the user know the file upload process. This article will introduce how to use PHP to implement the FTP file upload progress bar function. 2. The basic idea of ??implementing the progress bar of FTP file upload. The progress bar of FTP file upload is usually calculated by calculating the size of the uploaded file and the size of the uploaded file.

What does linux ftp 530 mean? What does linux ftp 530 mean? Mar 14, 2023 am 10:16 AM

linux ftp530 means linux ftp login error 530. The solution is: 1. Check "cat /etc/shells" to see if your user's home directory and login shell are there. If not, add them; 2. Check "/var /log/secure" file and reset the password expiration time.

See all articles