0

サーバーにApache仮想ホストをセットアップしたい

私の登録ドメイン名は www.abcd.com です

ネームサーバー1: NS1.ABCD.COM

ネームサーバー2: NS2.ABCD.COM

私の静的IP: 112.123.124.195

上記の静的 IP アドレスから自分の Web サイトにアクセスできますが、www.abcd.com からこのサーバーにアクセスするように vhost ファイルをセットアップしたいと考えています。

私の現在の仮想ホストファイルは次のとおりです。登録したドメインからアクセスできるようにこのファイルを設定するのを手伝ってください。

enter code here
#
# 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 postmaster@dummy-host.localhost
    ##DocumentRoot "G:/xampp/htdocs/dummy-host.localhost"
    ##ServerName dummy-host.localhost
    ##ServerAlias www.dummy-host.localhost
    ##ErrorLog "logs/dummy-host.localhost-error.log"
    ##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host2.localhost
    ##DocumentRoot "G:/xampp/htdocs/dummy-host2.localhost"
    ##ServerName dummy-host2.localhost
    ##ServerAlias www.dummy-host2.localhost
    ##ErrorLog "logs/dummy-host2.localhost-error.log"
    ##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>

enter code here
4

1 に答える 1

2

このようなものをhttpd-vhosts.confに入れることができます

<VirtualHost 210.212.143.195>
    ServerName www.abcd.com
    ServerAlias abcd.com   
    ServerAdmin webmaster@localhost
    DocumentRoot the/root/to your/webfolder
    ServerName example.com

    <Directory "the/root/to your/webfolder">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        order allow,deny
        allow from all
    </Directory>
</VirtualHost>

Windowsホストファイル(windows / system32 / drivers / etc / hosts)に含める必要があるよりもローカルホストの下で必要な場合

 210.212.143.195 www.abcd.com
于 2012-06-01T15:12:22.297 に答える