CENTOS7 compile and install Apache after adding user authentication and configuring the virtual host

Source: Internet
Author: User

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

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.