apache基础
Posted 魅力男神
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache基础相关的知识,希望对你有一定的参考价值。
apache基于多域名的虚拟主机
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/var/www/html/xk/shuyou"
ServerName www.shuyou.group
ServerAlias shuyou.group
ErrorLog logs/shuyou_error.log
CustomLog logs/shuyou_access.log common
</VirtualHost>
<VirtualHost *:80>
ServerName www.lizhi.group
DocumentRoot "/var/www/html/xk/lizhi"
ErrorLog logs/lizhi_error.log
CustomLog logs/lizhi_access.log common
</VirtualHost>
禁用一个或多个ip访问
<Directory "/var/www/html">
Order deny,allow
Allow from 0.0.0.0
deny from 192.168.1.153
</Directory>
定义跳转
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^lizhi.group$ [OR]
RewriteRule ^(.*)$ http://www.shuyou.group/$1 [R=301,L]
以上是关于apache基础的主要内容,如果未能解决你的问题,请参考以下文章
linux[基础]-29-[Apache服务]-[安装Apache服务]-[01]