Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache虚拟主机到动态IP_Apache_Configuration_Webserver_Virtualhost - Fatal编程技术网

Apache虚拟主机到动态IP

Apache虚拟主机到动态IP,apache,configuration,webserver,virtualhost,Apache,Configuration,Webserver,Virtualhost,我希望实现以下目标: 在任何给定的时间点,如果局域网中的任何人(包括我)知道我的IP地址和主机文件中他或她拥有192.168.1.xxx beta.example.com,通过访问beta.example.com他或她将从我的apache获得beta.example.com服务。除了我,我可以拥有自己的127.0.0.1 beta.example.com 我试过这个,它只在本地有效。对于外部连接,它默认为DocumentRoot,如果用户试图访问http://beta.example.com/e

我希望实现以下目标:

在任何给定的时间点,如果局域网中的任何人(包括我)知道我的IP地址和主机文件中他或她拥有
192.168.1.xxx beta.example.com
,通过访问
beta.example.com
他或她将从我的apache获得beta.example.com服务。除了我,我可以拥有自己的
127.0.0.1 beta.example.com

我试过这个,它只在本地有效。对于外部连接,它默认为
DocumentRoot
,如果用户试图访问
http://beta.example.com/example.com/

    Listen *:80
    ServerName localhost:80
    DocumentRoot "c:/www"

<VirtualHost beta.example.com>
    DocumentRoot "c:\www\example.com"
    ServerName beta.example.com
</VirtualHost>


<Directory "c:\www\example.com">
    Options +FollowSymLinks
    AllowOverride All
</Directory>
Listen*:80
ServerName本地主机:80
DocumentRoot“c:/www”
DocumentRoot“c:\www\example.com”
ServerName beta.example.com
选项+FollowSymLinks
允许超越所有

我应该换什么?这可能吗?

做到了。这很简单。将
替换为:

   NameVirtualHost *:80
   <VirtualHost *:80>
NameVirtualHost*:80

成功了。这很简单。将
替换为:

   NameVirtualHost *:80
   <VirtualHost *:80>
NameVirtualHost*:80