Creating virtual host configurations on your Apache server


Server configuration
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
DocumentRoot /www/example1
ServerName www.example1.com
ServerAdmin you@yourphpsite.org
CustomLog /home/yourphpsite/access.log combined
ErrorLog /home/yourphpsite/error.log
# Other directives here
DocumentRoot /www/example2
ServerName www.example2.org
ServerAdmin you@yourphpsite.org
CustomLog /home/yourphpsite/access.log combined
ErrorLog /home/yourphpsite/error.log
# Other directives here

Server configuration
Listen 80
# This is the "main" server running on 172.20.30.40
ServerName server.domain.com
DocumentRoot /www/mainserver
# This is the other address
NameVirtualHost 172.20.30.50
DocumentRoot /www/example1
ServerName www.example1.com
# Other directives here ...
DocumentRoot /www/example2
ServerName www.example2.org
# Other directives here ...
http://httpd.apache.org/docs/2.0/vhosts/examples.html

Nhận xét

Bài đăng phổ biến từ blog này

dung lượng RAM lớn nhất mà HĐH cấu trúc 32-bit nhận được

Ký tự viết tắt trong chat & email

Ubuntu LAMP Server