Apache configuration of various virtual host practices-Linux Enterprise Application-Linux server application information, the following is a detailed description.
1. practice environment: Red Hat Enterprise Linux AS release 4 (Nahant Update 3)
Server version: Apache/1.3.34 (Unix)
Server built: Sep 26 2006 15:06:28
2. Domain Name-based VM: Vi httpd. conf
......
......
BindAddress *
Indicates that all addresses can be used to listen to VM requests.
NameVirtualHost *: 80
Use a domain name-based VM
ServerName mail. OK .com
DocumentRoot/var/www/html
ScriptAlias/cgi-bin/"/opt/apache/cgi-bin /"
Summary: this domain name-based configuration is suitable when the server has only one public ip address. Each virtual host must be set Command block. You can add commands other than ServerType, Startservers, MaxSpareserver, MinSpareserver, MaxRequestsPerchild, BindAddress, Lister, PidFile, TypeConfig, ServerRoot, and NameVirtualHost. This method must depend on DNS resolution.
3. IP address-based VM
Vi httpd. conf
......
......
BindAddress *
Indicates that all addresses can be used to listen to VM requests.
# NameVirtualHost *: 80
Use a domain name-based VM
ServerName mail. OK .com
DocumentRoot/var/www/html
ScriptAlias/cgi-bin/"/opt/apache/cgi-bin /"
Vi httpd. conf
......
......
BindAddress *
Indicates that all addresses can be used to listen to VM requests.
Listen 8080.
Let apache listen to port 8080. Here the ip: port mode is used.
# NameVirtualHost 192.168.0.246: 8080
Use a virtual host based on domain name. If you want to use the Domain Name: port mode, open it here.
ServerName mail. OK .com
DocumentRoot/var/www/html
ScriptAlias/cgi-bin/"/opt/apache/cgi-bin /"
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.