apache2添加模块和添加站点

apache2添加模块和添加站点

linux下的apache2的目录和windows上的区别还是很大的,但是用起来却更方便了,详解请看另一篇文章http://www.cnblogs.com/wancy86/p/linux_apache2.html

这里补充两个命令:

添加模块:

model_name是mods-available 下的模块名

sudo a2enmod model_name
sudo a2enmod proxy 

开启vhost:

vhost_conf 是sites-available下的vhost配置文件名,文件名中不带.#

sudo a2ensite vhost_conf
sudo a2ensite mysite

vhost配置文件模板:

NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
	ServerName tuitu.cn
	ServerAdmin wancy86@sina.com
	
	DocumentRoot /var/www/demo/
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/demo/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

posted @ 2016-06-12 22:57  CooMark  阅读(1197)  评论(0编辑  收藏  举报