我有多个域名注册。 我想在私有虚拟服务器上使用一台Apache服务器来托pipe它们。 我知道这是可能的,通过在httpd.conf和(可能/ etc / hosts)中进行更改,但我找不到任何有关如何实际执行的信息。
任何人都可以请解释这样做所需的步骤? 例如,假设我有以下名称可用:
我怎样才能设置Apache服务器,使其服务于上述域的页面?
顺便说一下,我正在运行Apache 2.2。 在Ubuntu Linux上(Lucid Lynx [10.04 LTS])
这应该可以帮助你: http : //www.debian-administration.org/articles/412
编辑apacheconfiguration=> httpd.conf
添加以下行:
#if you are listening in the port 80, enable the virtual host NameVirtualHost *:80 #DocumentRoot is the folder where the actual web site resides, where the html and php files are. #Directory => this instruction is for setting the permissions, de directory index, etc. <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:/mywebsites/example1" ServerName example1.com ServerAlias www.example1.com <Directory "C:/mywebsites/example1"> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:/mywebsites/example2" ServerName example2.com ServerAlias www.example2.com <Directory "C:/mywebsites/example2"> DirectoryIndex index.html AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "C:/mywebsites/example3" ServerName example3.com ServerAlias www.example3.com <Directory "C:/mywebsites/example3"> DirectoryIndex default.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
你可能已经意识到,我正在运行windows,但是对于unix来说是一样的。 有关更多信息,请阅读指令DocumentRoot,VirtualHost和Directory的Apacheconfiguration。
所有这一切,如果有人问a2p服务器的example2.com,Apache将服务从C:/ mywebsites / example2使用索引index.html的请求。 但需要问阿帕奇(礼貌…)我的意思是,你必须改变你的DNS指向这个网站的网卡IP地址Apache正在监听。
在我的电脑中,Windows使用主机文件,如下所示:
example1.com 127.0.0.1 www.example1.com 127.0.0.1 example2.com 127.0.0.1 www.example2.com 127.0.0.1
因为我在httpd.conf中设置了这个指令
Listen 80
问候
亚历克斯