Let me give you an example:
Let's say your PHP is installed under d:/php/.
Copy Php4apache.dll (Php4apache2.dll) to d:/php/
Under the httpd.conf of Aapche, add the following:
######################################################
Aapche1 is:
LoadModule php4_module "D:/php/php4apache.dll"
Aapche2 is:
LoadModule php4_module "D:/php/php4apache2.dll"
To add an extension that is parsed by PHP:
AddType application/x-httpd-php. phtml pwml. php3. PhP4. PHP PhP2. Inc Izz
######################################################
Now, you can support PHP just by restarting Apache.
Apachemodulegzip (ie: mod_gzip) is a free Apache module provided by remote communications to compress static Web pages. It works well and you just have to compile it with Apache (or use it as a DSO).
You can also download on Ice ice site:
Http://justdn.com/down/apache/ApacheModuleGzip.dll
More PHP acceleration and buffering suggestions can be obtained in ice-ice PHP documents.
How does Apache build a virtual host? The following is a brief introduction to domain-based virtual hosts.
For example, your server address is: 61.132.27.69 (this is Ice ice), now we want to build www.justdn.org and www.justdn.com two virtual hosts.
After the Apache httpd.conf, add the following code
Here's an explanation,
ServerAdmin, is the administrator's mailbox.
DocumentRoot, the site documentation directory for this virtual host.
ServerName, domain name slightly.
Serveralias justdn.com wwww.justdn.com, which means you can access the site with www.justdn.com and justdn.com.
ErrorDocument 404/404.html, which refers to customizing the site's 404 pages as 404.html files under the root of the site.
Description
The Unix platform uses the same settings as the Apache server for the NT platform. The following focuses on the UNIX platform as an example of the Apache server settings. It is also noteworthy that the success of the virtual Web settings, about 50% of the workload is in the domain name registration and resolution. So generally first register a good domain name and then do the virtual Web settings.
First, IP-type virtual host
IP-type virtual host refers to each virtual host corresponding to a unique IP. This approach is supported by multiple physical or virtual network ports for multiple ip,solaris2.5 and Windows NT.
Two ways to configure multiple virtual hosts:
1, for each virtual host to start a httpd process.
Use this method in the following situations:
1 need to consider security isolation issues, such as two httpd run in different user, Group, Listen, ServerRoot, both users, in addition to browsing data through the Web, can not access other data.
2 can provide enough memory and file descriptor.
To set the method:
For each virtual host to establish a separate httpd installation, in each installation path of the configuration file httpd.conf, with Listen instructions to specify the process services IP, such as: Listen 10.68.37.10:80
2. Start a httpd process for all virtual hosts.
Use this method in the following situations:
1 allows the httpd configuration to be shared between virtual hosts.
2 computer services to a large number of requests, running multiple processes to reduce server performance is an important factor to consider.
To set the method:
In the configuration file httpd.conf, use the VirtualHost directive to set serveradmin, ServerName, DocumentRoot, ErrorLog, Transferlog, or Customlog for each virtual host, such as:
〈virtualhost www.smallco.com〉 #此处建议用IP
ServerAdmin webmaster@mail.smallco.com
Documentroot/usr/local/etc/httpd/htdocs/smallco
ServerName www.smallco.com #建议此处用域名
Errorlog/usr/local/etc/httpd/logs/smallco/error_log
Transferlog/usr/local/etc/httpd/logs/smallco/access_log
〈/virtualhost〉
〈virtualhost www.baygroup.org〉 #此处建议用IP
ServerAdmin webmaster@mail.baygroup.org
Documentroot/groups/baygroup/www
ServerName www.baygroup.org #建议此处用域名
Errorlog/groups/baygroup/logs/error_log
Transferlog/groups/baygroup/logs/access_log
〈/virtualhost〉
At the same time to do the virtual network port or network card configuration, in DNS to do the appropriate settings.
Second, the name Type virtual host (Apache1.3 above version support)
IP-type virtual host is good, but not the best solution. It requires that each virtual host has a dedicated IP, which is difficult to implement on some machines. Name-type virtual host is the name of each virtual host is not the same, but the same IP. Its advantage is not limited the number of virtual hosts, configuration, use simple, no additional hardware and software. The disadvantage is that the client must support this part of the protocol, the most recent version of the browser is supported, some older browsers do not support. But Apache provides a workaround for this.
To set the method:
In the configuration file httpd.conf, set up the virtual host with the Namevirtualhost directive, such as:
Namevirtualhost 111.22.33.44
〈virtualhost 111.22.33.44〉 #建议此处用IP
ServerName Www.domain.tld #建议此处用域名
Documentroot/web/domain
〈/virtualhost〉
Also, the DNS definition www.domain.tld points to 111.22.33.44.
Note: When using IP after the namevirtualhost instruction, any URL request using IP is for the virtual host, and the primary server will never respond to a URL request using IP. In addition, some servers want to be accessed with multiple names. For example, if you have a server with an IP that you want to be able to access by name Domain.tld and Www2.domain.tld, use the Serveralias directive in the virtualhost instruction section. such as: Serveralias domain.tld *.domain.tld
Attach some settings instances of the virtual host.
Attached: Virtual host Settings instance
IP-type Virtual host configuration
Setup 1: The server has two IP,
111.22.33.44 Server.domain.tld
111.22.33.55 Www.otherdomain.tld
Www.domain.tld is a server.domain.tld alias (CNAME) that represents the primary server.
Server configuration:
...
Port 80
Documentroot/www/domain
ServerName Www.domain.tld
〈virtualhost 111.22.33.55〉
Documentroot/www/otherdomain
ServerName Www.otherdomain.tld
...
〈/virtualhost〉
Setup 2: Basically the same Setup1, but does not set up a dedicated primary server.
Server configuration:
...
Port 80
ServerName Server.domain.tld
〈virtualhost 111.22.33.44〉
Documentroot/www/domain
ServerName Www.domain.tld
...
〈/virtualhost〉
〈virtualhost 111.22.33.55〉
Documentroot/www/otherdomain
ServerName Www.otherdomain.tld
...
〈/virtualhost〉
This setting hits the primary server only if the URL is http://server.domain.tld
Setup 3: The server has two IP,
111.22.33.44 Server.domain.tld
111.22.33.55 Www-cache.domain.tld
Www.domain.tld is a server.domain.tld alias (CNAME) that represents the primary server.
The Www-cache.domain.tld is Proxy-cache, and the port is the default 80 for the 8080,web server.
Server configuration:
...
Port 80
Listen 111.22.33.44:80
Listen 111.22.33.55:8080
ServerName Server.domain.tld
〈virtualhost 111.22.33.44:80〉
Documentroot/www/domain
ServerName Www.domain.tld
...
〈/virtualhost〉
〈virtualhost 111.22.33.55:8080〉
ServerName Www-cache.domain.tld
...
〈directory proxy:〉
Order Deny,allow
Deny from all
Allow from 111.22.33
〈/directory〉
〈/virtualhost〉
Name-type virtual host configuration
Setup 1: The server has an IP,
111.22.33.44 Server.domain.tld.
Www.domain.tld and Www.sub.domain.tld are aliases (cnames).
Server configuration:
...
Port 80
ServerName Server.domain.tld
Namevirtualhost 111.22.33.44
〈virtualhost 111.22.33.44〉
Documentroot/www/domain
ServerName Www.domain.tld
...
〈/virtualhost〉
〈virtualhost 111.22.33.44〉
Documentroot/www/subdomain
ServerName Www.sub.domain.tld
...
〈/virtualhost〉
If you use an IP Access server, because Www.domain.tld has the highest priority, it is considered the default server or
First server.
Setup 2: The server has two IP,
111.22.33.44 SERVER1.DOMAIN.TLD for Primary server
111.22.33.55 Server2.domain.tld for Virtual hosts
Alias Www.domain.tld is used for the primary server,
Alias Www.otherdomain.tld is used for a virtual host,
Alias Www.sub.domain.tld,*.sub.domain.tld for another virtual host,
Server configuration:
...
Port 80
ServerName Www.domain.tld
Documentroot/www/domain
Namevirtualhost 111.22.33.55
〈virtualhost 111.22.33.55〉
Documentroot/www/otherdomain
ServerName Www.otherdomain.tld
...
〈/virtualhost〉
〈virtualhost 111.22.33.55〉
Documentroot/www/subdomain
ServerName Www.sub.domain.tld
Serveralias *.sub.domain.tld
...
〈/virtualhost〉
Mixed type (ip/name) virtual Host Configuration
Setup: The server has three IP,
111.22.33.44 server.domain.tld for first-name virtual hosts
111.22.33.55 www.otherdomain1.tld for IP-type virtual hosts
111.22.33.66 www.otherdomain2.tld for IP-type virtual hosts
Server configuration:
...
Port 80
ServerName Server.domain.tld
Namevirtualhost 111.22.33.44
〈virtualhost 111.22.33.44〉
Documentroot/www/domain
ServerName Www.domain.tld
...
〈/virtualhost〉
〈virtualhost 111.22.33.44〉
Documentroot/www/subdomain1
ServerName Www.sub1.domain.tld
...
〈/virtualhost〉
〈virtualhost 111.22.33.44〉
Documentroot/www/subdomain2
ServerName Www.sub2.domain.tld
...
〈/virtualhost〉
〈virtualhost 111.22.33.55〉
Documentroot/www/otherdomain1
ServerName Www.otherdomain1.tld
...
〈/virtualhost〉
〈virtualhost 111.22.33.66〉
Documentroot/www/otherdomain2
ServerName Www.otherdomain2.tld
...
〈/virtualhost〉
Port-Type Virtual host configuration
Setup: The server has an IP,
111.22.33.44 Www.domain.tld
Without additional aliases or IP, a port-type virtual host can be used to set a configuration that differs from the primary server's virtual
Intended host.
Server configuration:
...
Listen 80
Listen 8080
ServerName Www.domain.tld
Documentroot/www/domain
〈virtualhost 111.22.33.44:8080〉
Documentroot/www/domain2
...
〈/virtualhost〉
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.