There are currently 4 posts.
Font size: Small - 100% (Default)  Content converter: No conversion
 
Clicks Replies
2471 3
【LAMP】ubuntu下的apache绑定多个域名到不同目录
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 1 Posted at: 7/14/13 13:27
注意:用这种方法不需要使用rewrite模块
在/etc/apache2/sites-enabled目录中新建一个空白文件,名字随便
内容:
<VirtualHost *:80>
DocumentRoot 文件路径
ServerName 域名
</VirtualHost>

如:
<VirtualHost *:80>
DocumentRoot /var/www/purasbar/2.0
ServerName oct1158.8800.org
</VirtualHost>



保存后直接重启apache服务器:sudo service apache2 restart

哈哈,就这么简单,比以前使用rewrite简单多了
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 2 Posted at: 7/14/13 13:28
/var/www/index.html那个It works就让他留在那里吧。。反正没什么用
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 3 Posted at: 7/14/13 13:33
以前我需要安装rewrite模块,还不是使用sudo a2enmod rewrite安装,而是要改一堆配置文件。。。。。来安装
然后我在/etc/apache2/sites-enabled/000-default中添加一堆重写代码,每个域名需要10行左右的代码。。。。靠!
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 4 Posted at: 7/14/13 13:33
现在只需要在/etc/apache2/sites-enabled/新建空白文件,然后只需要4行代码就能绑定域名了。
Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
(Shortcut key: Ctrl+Enter)
Post Information
Clicks: 2471 Replies: 3
Author: 巨大八爪鱼
Last reply: 巨大八爪鱼
Last reply time: 7/14/13 13:33
Good area: 网页编程
Bar Good Posts
Announcements