ubuntu下使用sudo apt-get install apache2方法安装时,配置文件主要在/etc/apache2/目录下。主要有:
apache2.conf : 主配置文件,会通过include的方式包含其他的配置文件
ports.cong : 可以配置你需要启用的端口号
mods-available : 可用模块
mods-enable : 已经启用的模块 (我所知道的启用模块的两种方法:ps:以mods-rewrite为例 1. sudo a2enmod rewrite 2.在mods-enable中建立mods-available中相关模块的软连接 sudo ln -s **** #### ps:第一种我用过,第二种我没用过,不过第一条命令的结果就是在mods-enable中建立了一个软连接,所以我觉得第二个方法应该也可行)
在site-enable中配置多站点我已知的有两种方法:
1.通过不同的端口号来访问不同的网站,例如 http://localhost:80 http://localhost:81
配置方法为:
<VirtualHost *:80> DocumentRoot: 80端口对应的网站的目录 </VirtualHost> <VirtualHost *:81> DocumentRoot: 81端口对应的网站的目录 </VirtualHost>
2.通过Alias来实现,例如 http://localhost/demo1 http://localhost/demo2
<VirtualHost *:80> Alias /demo1 "存放第一个网站的目录" Alias /demo2 "存放第二个网站的目录" </VirtualHost>