溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何配置Apache服務(wù)器中的虛擬機

發(fā)布時間:2021-11-06 09:46:15 來源:億速云 閱讀:94 作者:柒染 欄目:建站服務(wù)器

這篇文章將為大家詳細講解有關(guān)如何配置Apache服務(wù)器中的虛擬機,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個參考,希望大家閱讀完這篇文章后對相關(guān)知識有一定的了解。

1

## Virtual Hosts## If you want to maintain multiple domains/hostnames on your# machine you can setup VirtualHost containers for them. Most configurations# use only name-based virtual hosts so the server doesn't need to worry about# IP addresses. This is indicated by the asterisks in the directives below.## Please see the documentation at# <URL:http://httpd.apache.org/docs/2.2/vhosts/># for further details before you try to setup virtual hosts.## You may use the command line option '-S' to verify your virtual host# configuration.## Use name-based virtual hosting.#NameVirtualHost *:80## VirtualHost example:# Almost any Apache directive may go into a VirtualHost container.# The first VirtualHost section is used for all requests that do not# match a ServerName or ServerAlias in any <VirtualHost> block.#<VirtualHost *:80>#管理員郵箱ServerAdmin jiangfeng3@staff.sina.com.cn #項目根目錄 DocumentRoot "D:/htdocs/frame_export" #域名 ServerName test.t.sina.com.cn #別名 ServerAlias test.t.sina.com.cn#錯誤日志路徑ErrorLog "logs/test.t.sins.com.cn-error.log"CustomLog "logs/test.t.sins.com.cn-access.log" commonRewriteEngine on#重寫規(guī)則,可根據(jù)實際需要添加RewriteRule ^/(.*)$ /apps/index.php [L]</VirtualHost>

4、編輯本地host文件,以windows為例

進入C:/Windows/System32/drivers/etchttp://www.bbqmw.net/

記事本打開hosts文件

最后添加

127.0.0.1 localhost
127.0.0.1 test.t.sina.com.cn

例子:

1

# Copyright (c) 1993-2009 Microsoft Corp.## This is a sample HOSTS file used by Microsoft TCP/IP for Windows.## This file contains the mappings of IP addresses to host names. Each# entry should be kept on an individual line. The IP address should# be placed in the first column followed by the corresponding host name.# The IP address and the host name should be separated by at least one# space.## Additionally, comments (such as these) may be inserted on individual# lines or following the machine name denoted by a '#' symbol.## For example:## 102.54.94.97 rhino.acme.com # source server# 38.25.63.10 x.acme.com # x client host# localhost name resolution is handled within DNS itself.127.0.0.1 localhost# ::1 localhost127.0.0.1 test.t.sina.com.cn

關(guān)于如何配置Apache服務(wù)器中的虛擬機就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI