Directory files after compiling and installing Apache:/usr/local/apache2
1: user authentication
Master configuration directory:/usr/local/apache2/conf/
1 ) to set up the directory and user authentication:
alias/1.php/"/usr/local/apache2/htdocs/1.php"
<directory "/usr/local/apache2/htdocs/" >
AllowOverride None
Options None
Order Allow,deny
Deny from all
AuthType Basic
AuthName "Please Login:"
AUTHUSERFILE/USR/LOCAL/APACHE2/BIN/MYWEBPD # directory where passwords are stored
Require user Root Tong # users
</Directory>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8B/29/wKiom1hGE-GyiaH2AACYk_NjXXc788.png-wh_500x0-wm_3 -wmp_4-s_1458770237.png "style=" Float:none; "title=" Qq20161206092528.png "alt=" Wkiom1hge-gyiah2aacyk_ Njxxc788.png-wh_50 "/>
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/8B/26/wKioL1hGE-LiU-l5AADc6SNH16g522.png-wh_500x0-wm_3 -wmp_4-s_4179850374.png "style=" Float:none; "title=" Qq20161206092547.png "alt=" Wkiol1hge-liu-l5aadc6snh16g522.png-wh_50 "/>
2: Configure the virtual host /usr/local/apache2/conf/extra/httpd-vhosts.conf
Configure IP-based virtual hosts with the sameIP address, but with different port numbers for the virtual host configuration,
The respective directories for the virtual host are/USR/LOCAL/APACHE/HTDOCS/WEB1 and/USR/LOCAL/APACHE/HTDOCS/WEB2:
Listen 80
#Listen 8080
<virtualhost 192.168.217.137:80>
Serversignature Email
Documentroot/usr/local/apache/htdocs/web1
DirectoryIndex web1.html
LogLevel Warm
Hostnamelookups off
</VirtualHost>
<virtualhost 192.168.217.137:8080>
Serversignature Email
Documentroot/usr/local/apache/htdocs/web2
DirectoryIndex web2.html index.htm
LogLevel Warm
Hostnamelookups off
</VirtualHost>
:
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/8B/29/wKiom1hGFiOSYF_JAAB48wfhdIU455.png-wh_500x0-wm_3 -wmp_4-s_313577751.png "title=" Qq20161206093513.png "alt=" Wkiom1hgfiosyf_jaab48wfhdiu455.png-wh_50 "/>
This article from "Do not forget Beginner's mind" blog, reproduced please contact the author!
CENTOS7 compile and install Apache after adding user authentication and configuring the virtual host