Linux (12) ___apache Server user authentication, virtual host configuration

Source: Internet
Author: User

Create a Xiangkejin Zhangsan two users

You can see two users created in a file:

Establish a virtual directory and configure user authentication

① creating a virtual directory/xiangkejin

② in the main configuration file httpd.conf file of Apache, add the following statement

Alias/xiangkejin "/xkj"
<directory "/XKJ" >
AuthType Basic
AuthName "This is a private website"
Authuserfile/etc/httpd/password
Require Valid-user
</Directory>

Service httpd Restart Remember to restart

To access the virtual directory in the browser:

Enter the account password that you previously set to access it. ———————————————— This is the next blog post just add a user authentication, in the previous blog, how can not access the virtual directory,

No permissions are displayed. And here it is, strange? I don't know why.

Configuration of the virtual host:

IP address-based virtual host:

Create another network card, now there are two network cards, each assigned an IP address.

First Open the port:

Configuration:

Then enter the address in the browser, an IP address corresponding to a site.

Domain-based virtual hosting:

To access the domain name entered in the browser successfully, set the domain name IP address mapping relationship in the Hosts file.

Linux (12) ___apache Server user authentication, virtual host configuration

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.