Apache的默认虚拟主机的多个域 [英] Apache default virtual host for multiple domains

查看:132
本文介绍了Apache的默认虚拟主机的多个域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,例如site1.com,site2.com,配置了自己的虚拟主机在自己的文件中启用了阿帕奇直升机和可用的文件夹,在自己的服务器上的物理文件夹,并用不同的.htaccess,他们做工精细。现在我希望所有未单独配置的其他领域(例如site3.com,site4.com ....)有一个相同的虚拟主机,相同的物理文件夹,并执行相同/文件夹1 / FOLDER2 /索引。 PHP文件。到目前为止,我已经取得了一些虚拟主机,但我得到的是它的工作,可能是因为一切都从默认的虚拟主机到/ var / WWW重定向。但是,如果我在文件中设置的DocumentRoot指令的的.htaccess由于某种原因不能正常工作了,我说,定义站点工作正常。什么应该叫虚拟主机文件,应该是什么它的内容?

I have, for example site1.com, site2.com, configured with their own virtual hosts in their own files in the apaches enabled and available folders, in their own physical folders on the server and with different .htaccess and they are working fine. Now I want all the other domains that are not separately configured (for example site3.com, site4.com ....) to have one same virtual host, same physical folder, and to execute the same /folder1/folder2/index.php file. So far, I've made some virtual hosts but all I get is "It's working", probably because everything is redirected from the default virtual host to the /var/www. But if I set the DocumentRoot directive in that file, the .htaccess for some reason is not working, and I said that for the defined sites are working OK. What the virtual host file should be called, what should be it's content?

推荐答案

您可以定义一个虚拟主机的容器,有许多的 ServerAlias​​ 条目,因为你需要。

You can define a VirtualHost container that has as many ServerAlias entries as you need.

下面是一个非常简单的例子:

Here's a very simplified example:

<VirtualHost *>
    ServerName site3.com
    ServerAlias site4.com
    DocumentRoot /var/www/folder1/folder2
</VirtualHost>

如果你已经尝试过创建虚拟主机的文件,你重新启动Apache的?

If you've already tried creating vhost files, have you restarted apache?

如果把虚拟主机文件取决于什么发行你使用。如果你不熟悉的地方去的东西在你的发行版,请 http://wiki.apache.org/的httpd / DistrosDefaultLayout

Where to put the vhost files depends on what distro you're using. If you're not familiar with where stuff goes on your distro, check http://wiki.apache.org/httpd/DistrosDefaultLayout.

这篇关于Apache的默认虚拟主机的多个域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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