|
啣 <Linux CENTOS 6 + Apache + mysql> 寞銝 1. vi /etc/httpd/httpd.conf! D# x+ G6 A% W9 f: E6 U
2. 曉 # VirtualHost example:- 嗡乩virtual server 閮剖,靘憒:
- #2014/10/02 add
- <VirtualHost 192.168.1.12:80> # <VirtualHost 127.0.0.1:80> #蝚西箄酉閫
- ServerAdmin [email protected]
- DocumentRoot /home/coav4u/public_html
- ServerName av4u.co
- ErrorLog logs/www.av4u.co-error_log
- CustomLog logs/www.av4u.co-access_log common
- </VirtualHost>
- <VirtualHost 192.168.1.12:80>
- ServerAdmin [email protected]
- DocumentRoot /home/coav4u/public_html
- ServerName www.av4u.co
- ErrorLog logs/www.av4u.co-error_log
- CustomLog logs/www.av4u.co-access_log common
- </VirtualHost>
銴鋆賭誨蝣 臬摰2 Domain name (av4u.comwww.av4u.com)啣銝祉征,典隡潔瘥 nginx 閮剖蝔敺桅獄拐暺; i9 P. O+ a: M# C6 U& Z9 V
3. Apache
5 t( H5 K. `9 }+ ?: L service httpd restart #隞叵oot頨怠 --->摰
0 t& h5 i- b }. Z 閮: service httpd start # & a6 G( ~3 r% Q/ X* b( [8 c9 j- r
service httpd start #甇; u& ~) i9 Y' q" p7 k d" Z
寞鈭
! _. s' H7 w6 l, ^/etc/httpd/conf.d/匐撱箔函瑼(閮剖銝virtual host)6 ^! P4 f' J- E% o2 p' j
靘憒: & g0 u% q7 {5 p. n% y
virtual1.conf8 k) y) [& y2 Q. @
- <VirtualHost 192.168.1.12:80> # <VirtualHost 127.0.0.1:80> #蝚西箄酉閫
- ServerAdmin [email protected]
- DocumentRoot /home/coav4u/public_html
- ServerName av4u.co
- ErrorLog logs/www.av4u.co-error_log
- CustomLog logs/www.av4u.co-access_log common
- </VirtualHost>
銴鋆賭誨蝣 virtual2.conf' Y7 M$ O# \ l
- <VirtualHost 192.168.1.12:80>
- ServerAdmin [email protected]
- DocumentRoot /home/coav4u/public_html
- ServerName www.av4u.co
- ErrorLog logs/www.av4u.co-error_log
- CustomLog logs/www.av4u.co-access_log common
- </VirtualHost>
銴鋆賭誨蝣 摮瑼嗅 httpd
; X2 k/ ]) n% w雿臬箇 error:9 O5 r7 g! C! s* i
[warn] _default_ VirtualHost overlap on port 80, the first has precedence2 I1 t, C. Y. G0 F. `5 F9 D
SOL:8 T" s6 z+ L2 Y1 ]+ R
望 /etc/httpd/conf/httpd.conf NameVirtualHost *:80 virtual1.confvirtual2.conf 折質身摰 <VirtualHost 192.168.1.12:80> 銝寥,甇蝣箇閮剖:
6 B! l; b8 T5 j; y% K4 phttpd.conf virtual1.confvirtual2.conf(砌蜓璈閮剖瑼)銝舫賜 *:80 撠望舫賜 192.168.1.12:80
, q0 G( j. s; D u0 R' B4 ]% [httpd.conf ===> NameVirtualHost *:80 , virtual1.confvirtual2.conf ===> <VirtualHost *:80> + F2 s' V, [' I6 \" X: s8 f
httpd.conf ===> NameVirtualHost 192.168.1.12:80 , virtual1.confvirtual2.conf ===> <VirtualHost 192.168.1.12:80>
9 w# s9 n. H/ L! t! Z! }9 a& X7 `% Z! w2 g) p
/ @" x7 r! f* F* c L& M
+ ^0 M. \6 ^' s, j3 @( E
|
|