文档详情

apache配置虚拟目录.pdf

发布:2017-08-27约5.48千字共4页下载文档
文本预览下载声明
ubuntu apache2 配置 Posted in linux by wanguan2000 on the 08 月 15th, 2008 ubuntu apache2 配置 1.apache2.conf 是主配置文件,httpd.conf 用户配置文件 2.虚拟目录在 httpd.conf 中 VirtualHost * DocumentRoot 路径 ServerName 名称 Directory 路径 allow from all Options +Indexes /Directory /VirtualHost 3.根设置(默认主目录)在 /etc/apache2/sites-available/default 4.重启命令 sudo /etc/init.d/apache2 restart或者 cd /etc/init. sudo apache2 -k restart stop 停止;start 启动 5. 日志文件在 /var/log/apache2/ VirtualHost *:80 ServerName DocumentRoot /home/vsftpd/kimoqi /VirtualHost VirtualHost *:80 ServerName DocumentRoot /home/vsftpd/wangguan/webapps /VirtualHost VirtualHost *:80 ServerName DocumentRoot /home/vsftpd/wangguan/chem /VirtualHost vi /etc/httpd/conf/httpd.conf 在 Windows 下,Apache 的配置文件通常只有一个,就是httpd.conf 。但我在Ubuntu Linux 上用 apt-get install apache2 命令安装了 Apache2 后,竟然发现它的httpd.conf (位于/etc/apache2 目录)是空的!进而发 现 Ubuntu 的Apache 软件包的配置文件并不像Windows 的那样简单,它把各个设置项分在了不同的配置 文件中,看起来复杂,但仔细想想设计得确实很合理。 严格地说,Ubuntu 的Apache (或者应该说Linux 下的Apache ?我不清楚其他发行版的apache 软件包)的 配置文件是/etc/apache2/apache2.conf ,Apache 在启动时会自动读取这个文件的配置信息。而其他的一些配 置文件,如httpd.conf 等,则是通过 Include 指令包含进来。在 apache2.conf 中可以找到这些Include 行: 引用 # Include module configuration: Include /etc/apache2/mods-enabled/*.load Include /etc/apache2/mods-enabled/*.conf # Include all the user configurations: Include /etc/apache2/httpd.conf # Include ports listing Include /etc/apache2/ports.conf …… # Include generic snippets of statements Include /etc/apache2/conf.d/ # Include the virtual host configurations: Include /etc/apache2/sites-enabled/ 结合注释,可以很清楚地看出每个配置文件的大体作用。当然,你完全可以把所有的设置放在 apache2.conf 或者httpd.conf 或者任何一个配置文件中。Apache2 的这种划分只是一种比较好的习惯。 安装完Apache 后的最重要的一件事就是要知道Web 文档根目录在什么地方,对于Ubuntu 而言,默认的 是/var/www 。怎么知道的呢?apache2.conf 里并没有 DocumentRoot 项,httpd.conf 又是空的,因此肯定在 其他的文件中。经过搜索,发现在/etc/apache2/sites-enabled/000-default 中,里面有这样的内容: 引用 NameVirtualHost * VirtualHost * ServerAdmin webmaster@localhost
显示全部
相似文档