在基于XAMPP的服务器中设置名称服务器? [英] Name server setup in XAMPP based server?

查看:165
本文介绍了在基于XAMPP的服务器中设置名称服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在服务器中设置apache虚拟主机

I want to setup the apache virtual host in my server

我的注册域名是www.abcd.com

My registered Domain name is www.abcd.com

名称服务器1:NS1.ABCD.COM

Name server1: NS1.ABCD.COM

名称服务器2:NS2.ABCD.COM

Name server2: NS2.ABCD.COM

我的静态IP:112.123.124.195

My static ip: 112.123.124.195

我可以从上面显示的静态IP地址访问我的网站,但是现在想要设置虚拟主机文件以从www.abcd.com访问此服务器

I can access my website from the static ip address shown above, but now want to setup the vhost file to access this server from the www.abcd.com

我当前的虚拟主机文件如下.请帮助我设置此文件以供从注册域访问.

My current virtual host file is as following. Please help me to set up this file for accessing from the registered domain.

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

推荐答案

您可以在httpd-vhosts.conf中放入这样的内容

you could put something like this in your 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) 如果要在localhost

than you should include in your windows host file (windows/system32/drivers/etc/hosts) If you want under localhost

 210.212.143.195 www.abcd.com

这篇关于在基于XAMPP的服务器中设置名称服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆