apache 配置虚拟主机 url重写功能

<VirtualHost *:80>

# The ServerName
directive sets the request scheme, hostname and port that

# the server
uses to identify itself. This is used when creating

# redirection
URLs. In the context of virtual hosts, the ServerName

# specifies
what hostname must appear in the request‘s Host: header to

# match this
virtual host. For the default virtual host (this file) this

# value is not
decisive as it is used as a last resort host regardless.

# However, you
must set it for any further virtual host explicitly.

ServerName yourhost.com
 #本地访问域名

ServerAdmin
[email protected]

DocumentRoot
/var/www/rgrass/public

<Directory />

AllowOverride
All

Options
Indexes FollowSymLinks MultiViews

allow
from all

Order
allow,deny

</Directory>

<Directory /var/www/rgrass/public
>

Options
Indexes FollowSymLinks MultiViews

AllowOverride
All

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>

# Available
loglevels: trace8, ..., trace1, debug, info, notice, warn,

# error, crit,
alert, emerg.

# It is also
possible to configure the loglevel for particular

# modules, e.g.

#LogLevel info
ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log
combined

# For most configuration
files from conf-available/, which are

# enabled or
disabled at a global level, it is possible to

# include a
line for only one particular virtual host. For example the

# following
line enables the CGI configuration for this host only

# after it has
been globally disabled with "a2disconf".

#Include conf-available/serve-cgi-bin.conf

</VirtualHost>

时间: 2024-11-03 21:01:38

apache 配置虚拟主机 url重写功能的相关文章

windows环境利用apache 配置虚拟主机

1.修改http.host #LoadModule vhost_alias_module modules/mod_vhost_alias.so #Include conf/extra/httpd-vhosts.conf 去掉这两项的# 2.修改httpd-vhosts.conf添加如下内容 <VirtualHost 127.0.0.1:80> DocumentRoot D:/wamp/www/trc ServerName www.abc.com </VirtualHost> 3.修

[Linux]Apache配置虚拟主机

Apache 配置虚拟主机的方式很多,种类也很多,主要分为两类: 基于名称的虚拟主机 (每个 IP 多个站点) 基于 IP 的虚拟主机 (每个 IP 一个站点) 基于名称的虚拟主机:  www.2cto.com 在windows下  Apache 的配置文件 conf/httpd.conf 中加载 虚拟主机配置文件  /extra/httpd-vhosts.conf 找到 Include "conf/extra/httpd-vhosts.conf" 取消注释即可. 现在,到httpd-

win10下关于apache配置虚拟主机

apache安装完默认是不开启虚拟服务器的,如果希望在本地apache上面配置虚拟服务器,类似于在网上买的虚拟主机,可以按照以下步骤进行配置: 1,修改本机的hosts文件,如下 示例:127.0.0.1 localhost127.0.0.1 xlb.com 127.0.0.1 xlb2.com 2,打开Apache的安装目录,找到httpd.conf文件,分别去掉下面两行文字前面的#号. LoadModule vhost_alias_module modules/mod_vhost_alias

mac 安装apache 配置虚拟主机

来源:http://blog.csdn.net/qianling3439/article/details/29410381 启动Apache 打开“终端(terminal)”,输入 sudo apachectl -v,(可能需要输入机器秘密).如下显示Apache的版本 接着输入 sudo apachectl start,这样Apache就启动了.打开Safari浏览器地址栏输入 “http://localhost”,可以看到内容为“It works!”的页面.其位于“/Library(资源库)

apache配置虚拟主机时需要注意到几个小细节

如今apache在web服务器这块市场占有率还是很高的,而配置虚拟主机现在也是用的非常多,不过在配置虚拟主机的时候一定要注意几个小细节. 首先要注意你的apache版本,注意是2.2还是2.4的. 配置2.2的时候,配置虚拟主机该这样写: NameVirtualHost ip:80   //注意此处与2.4不同 <VirtualHost ip:80> ServerName www1.myweb.com DocumentRoot "/myweb/vhost/www1" <

CentOS 5上Apache配置虚拟主机范例

昨天实践了下在CentOS 5上通过Apache直接配置虚拟主机,服务器没有安装面板软件,所以只能通过SSH远程连接操作了.Apache安装在/etc/httpd目录下,这个即是Apache的根目录,所以Apache配置文件/etc/httpd/conf/httpd.conf中的ServerRoot设置的是ServerRoot “/etc/httpd”.我们编辑httpd.conf,在虚拟主机配置区看到如下的代码: #NameVirtualHost *:80ps:中间数行无关紧要注释略去了.#<

Apache配置虚拟主机后,不能访问localhost的问题

今天想试用一下php7,但是发现php7只支持Apache2.4版本,而我电脑上的Apache是2.2版本,为了想尝鲜,就必须去下载新的Apache2.4 php7和apache2.4安装整合以后,localhost可以正常访问,没问题. 然后我又配置了几个虚拟主机,这时候,虚拟主机可以正常访问,但是localhost就访问不了了. 其实以前这种问题我也经历过,比如我之前用的php5.4搭配Apache2.2,就可以虚拟主机和localhost都可以访问: 但是我之前怎么解决的我也不记得了,今天

apache配置虚拟主机 个人理解

范例 Listen 80 #NameVirtualHost * <VirtualHost *:8080> ServerName apacheconfig2 DocumentRoot /var/www/apacheconfig/test1 DirectoryIndex index.html #站点的默认访问资源,即不指明请求资源时,默认访问index.html文件 <Directory "/var/www/apacheconfig/test1"> #设置对目录的访

虚拟机lamp环境下,Apache配置虚拟主机

1.在Apache配置文件中开启虚拟主机功能:即:Include etc//extra/httpd-vhosts.conf把前面的#去掉: 2.在extra目录下找到文件httpd-vhosts.conf,添加如下配置: <Directory "/Data/www/thinkphp"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted </Dire