PHP Study Notes (1)

Source: Internet
Author: User

Download http://httpd.apache.org on httpd-2.2.22-win32-x86-no_ssl.msi/

 

Chinese Reference Manual for http://apache.chinahtml.com/apache2.2

Httpd. conf file

Listen 80

You can set the port number (you can listen to multiple ports at the same time)

 

Configure virtual directories and Access Permissions

In

<Ifmodule dir_module>
Directoryindex index.html
</Ifmodule>

Add

<Ifmodule dir_module>
Directoryindex index.html index.htm index. php
Alias/myphp "E: \ apache"
<Directory e: \ apache/>
Order deny, allow
Allow from all
</Directory>
</Ifmodule>

 

Where:

<Directory e: \ apache/>
Order deny, allow
Allow from all
</Directory>

Access permission

 

You can log out DocumentRoot "D:/program files/Apache Software Foundation/apache2.2/htdocs" without the default home directory.

 

Configure the VM:

1. Enable the VM configuration file

In httpd. conf, there are:

# Virtual Hosts
Include CONF/extra/httpd-vhosts.conf

 

2. Add in httpd-vhosts.conf

<Virtualhost 127.0.0.1: 80>
DocumentRoot "E: \ apache"
Directoryindex index.html index.htm index. php
<Directory e: \ apache/>
Options followsymlinks
AllowOverride none
Order deny, allow
Allow from all
</Directory>
</Virtualhost>

 

The browser parses the address first.

C: \ windows \ system32 \ drivers \ etc \ hosts

Query the relationship between the domain name and the IP address. If not, go to the DNS server.

 

 

How to set different domain names in a host to access different pages:

1. Enable the VM configuration file

In httpd-vhosts.conf:

<Virtualhost*: 80>
DocumentRoot "E: \ apache"

# Specify the domain name here

Servername www.baidu1.com
Directoryindex index.html index.htm index. php
<Directory e: \ apache/>
Options followsymlinks
AllowOverride none
Order deny, allow
Allow from all
</Directory>
</Virtualhost>

 

<Virtualhost*: 80>
DocumentRoot "D: \ apache"

Servername www.baidu2.com
Directoryindex index.html index.htm index. php
<Directory e: \ apache/>
Options followsymlinks
AllowOverride none
Order deny, allow
Allow from all
</Directory>
</Virtualhost>

 

2. Add the following content to the c: \ windows \ system32 \ drivers \ etc \ hosts file:

127.0.0.1 www.baidu1.com

127.0.0.1 www.baidu2.com

 

In this way, you can use www.baidu1.com and www.baidu2.com to access different pages respectively.

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.