時間:2023-07-17 12:21:01 | 來源:網(wǎng)站運(yùn)營
時間:2023-07-17 12:21:01 來源:網(wǎng)站運(yùn)營
Apache 配置虛擬主機(jī): 虛擬主機(jī)是在一臺Web服務(wù)器上,可以為多個獨(dú)立的IP地址、域名或端口號提供不同的Web站點(diǎn)。對于訪問量不大的站點(diǎn)來說,這樣可以降低單個站點(diǎn)的運(yùn)營成本。mkdir /var/www/ip1 /var/www/ip2echo "this is 192.168.184.128's web"> /var/www/ip1/index.htmlecho "this is 192.168.184.129's web"> /var/www/ip2/index.html
<Virtualhost 192.168.184.128> DocumentRoot /var/www/ip1</Virtualhost><Virtualhost 192.168.184.129> DocumentRoot /var/www/ip2</Virtualhost>
systemctl restart httpd
setenforce 0firewall-cmd --add-service=http --permanentfirewall-cmd --reload
mkdir /var/www/www1 /var/www/www2echo "www1.test123.com's web."> /var/www/www1/index.htmlecho "www2.test123.com's web."> /var/www/www2/index.html
<Virtualhost 192.168.184.128> DocumentRoot /var/www/www1 ServerName www1.test123.com</Virtualhost><Virtualhost 192.168.184.128> DocumentRoot /var/www/www2 ServerName www2.test123.com</Virtualhost>
systemctl restart httpd
192.168.184.128 www1.test123.com192.168.184.128 www2.test123.com
Windows操作系統(tǒng): 編輯C:/Windows/System32/drivers/etc/hosts,在配置文件后面添加一下內(nèi)容192.168.184.128 www1.test123.com192.168.184.128 www2.test123.com
mkdir /var/www/8088 /var/www/8089echo "8088 port's web."> /var/www/8088/index.htmlecho "8089 port's web."> /var/www/8089/index.html
Listen 8088Listen 8089<Virtualhost 192.168.184.128:8088> DocumentRoot /var/www/8088</Virtualhost><Virtualhost 192.168.184.128:8089> DocumentRoot /var/www/8089</Virtualhost>
systemctl restart httpd
firewall-cmd --add-port=8088-8089/tcp --permanentfirewall-cmd --reload
關(guān)鍵詞:主機(jī),虛擬,配置
客戶&案例
微信公眾號
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。