一段apache虚拟主机的配置代码

一段apache虚拟主机的配置代码,包括了对部分目录禁用php解析,apache日志目录等

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/defsite
#    ServerName unknown-host.example.com
ErrorLog logs/defsite-host.example.com-error_log
CustomLog logs/defsit-host.example.com-access_log common

#    <IfModule mod_php5.c>
#        php_admin_value open_basedir "/var/www/html/vhosts/testsite/html/:/tmp"
#    </IfModule>
#
#    <IfModule suexec.c>
#        SuexecUserGroup web_testsite web_testsite
#    </IfModule>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin tech@mysite.com
DocumentRoot "/var/www/html/vhosts/testsite/html"
ServerName www.testsite.com
ServerAlias job.mysite.com
ErrorLog "logs/testsite-error.log"
CustomLog "logs/testsite-access.log" common
<IfModule mod_php5.c>
php_admin_value open_basedir "/var/www/html/vhosts/testsite/html/:/tmp"
</IfModule>
RewriteLog "/var/www/html/vhosts/testsite/log/rewritelog.log"
</VirtualHost>
<Directory "/var/www/html/vhosts/testsite/html">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all

#AllowOverride AuthConfig  #this line and below is required to auth,
#  AllowOverride has been configured above, no need to re configure
#    AuthName web_testsite
#    AuthType Basic
#    AuthUserFile /var/www/htpasswd/testsite.htpasswd
#    require valid-user
</Directory>
<Directory "/var/www/html/vhosts/testsite/html/images">
AllowOverride None
Options FollowSymLinks
Order allow,deny
php_admin_flag engine off
Allow from all
</Directory>
<Directory "/var/www/html/vhosts/testsite/html/css">
AllowOverride None
php_admin_flag engine off
</Directory>
<Directory "/var/www/html/vhosts/testsite/html/data">
AllowOverride None
php_admin_flag engine off
</Directory>
<Directory "/var/www/html/vhosts/testsite/html/js">
AllowOverride None
php_admin_flag engine off
</Directory>

<VirtualHost *:80>
ServerAdmin tech@mysite.com
DocumentRoot "/var/www/html/vhosts/www2.mysite.com/html"
ServerName www2.mysite.com
ServerAlias job2.mysite.com
ErrorLog "logs/www2.mysite.com-error.log"
CustomLog "logs/www2.mysite.com-access.log" common
</VirtualHost>
<Directory "/var/www/html/vhosts/www2.mysite.com/html">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
ServerAdmin tech@mysite.com
DocumentRoot "/var/www/html/vhosts/z.mysite.com/html"
ServerName z.mysite.com
ErrorLog "logs/z.mysite.com-error.log"
CustomLog "logs/z.mysite.com-access.log" common
</VirtualHost>
<Directory "/var/www/html/vhosts/z.mysite.com/html">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
ServerAdmin tech@mysite.com
DocumentRoot "/var/www/html/vhosts/bbs.mysite.net/html"
ServerName bbs.mysite.com
ErrorLog "logs/bbs.mysite.net-error.log"
CustomLog "logs/bbs.mysite.net-access.log" common
</VirtualHost>
<Directory "/var/www/html/vhosts/bbs.mysite.net/html">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

phpmyadmin删除“追踪”(就是在表名旁的眼睛图标)/phpmyadmin(v3.3+)追踪功能简介

数据库phpmyadmin里的表pma_tracking,打开,里面即是追踪项的配置记录,删掉就可以了。

使用新版本的phpmyadmin,试用里面的追踪功能,不过用过后不知道怎么删掉了。于是google到这里,网上有人问同样问题,但没人回答。于是只好做罢,自己动手,丰衣足食。

猜想这是否是phpmyadmin本身的功能,而非mysql的;因为之前google这个问题时,搜索mysql trace并没有发现说mysql有这样的追踪功能。

于是查找phpmyadmin库,见表pma_tracking打开,删除记录,问题解决。

 

附:phpmyadmin官方中文文档的“追踪”功能简介:

$cfg['Servers'][$i]['tracking'] 字符串
自 3.3.x 起可以使用追踪功能。它可以帮你追踪每个通过 phpMyAdmin 执行的 SQL 命令。它支持记录数据修改和数据定义语句。启用后还可以创建数据表的版本。

创建版本会造成两个影响:

  • phpMyAdmin 保存当前数据表的快照,包括结构和索引。
  • phpMyAdmin 针对当前数据表记录的所有修改结构和/或数据的命令都将与版本关联。

当然你也能查看追踪到的修改。在"追踪"页里每个版本都会有一份完整的报告。你可以在报告中搜索,如你可以只列出一段时间内的语句。若想根据用户名搜索可以输入 * 表示任意用户或者输入 ',' 分隔的用户列表。你还可以导出 (包括搜索结果) 报告为文件或者临时数据库。

要启用此功能:

  • 设置好 pmadb 和 phpMyAdmin 高级功能
  • put the table name in $cfg['Servers'][$i]['tracking'] (e.g. 'pma_tracking')
$cfg['Servers'][$i]['tracking_version_auto_create'] 布尔
设置追踪系统是否自动为数据表和视图创建版本。默认为 false 。

若设为 true 然后你通过

  • CREATE TABLE ...
  • CREATE VIEW ...

创建了一张表或视图并且它当前没有任何版本,系统将会自动为你创建一个版本。

centos 6.x下的empathy安装包/rpm

直接上安装包

empathy-2.30_rpm_for_centos_f13

fedora13的二进制包,可以在centos 6.2下成功安装,并正常使用。这些包之间解决了包信赖,应该不再需要其它包;如果真的缺少了某个包,请通过yum 安装。

如果你的centos6安装有pidgin,推荐卸载掉,因为有个rpm包与centos6带的pidgin有冲突。

对于使用QQ的朋友,推荐下载安装这个 https://code.google.com/p/libqq-pidgin/ ,empathy/pidgin自带的QQ协议老了,而不再被tx支持。

centOS 6下通过yum安装php-mssql以使php支持microsoft sql server连接

centos 6下,安装fedoraproject的epel-release源,即可以安装php的mssql模块。

注:epel是fedora开发组为centos开发的附加软件yum源,可以弥补centos上游redhat里缺少的软件包。epel的质量还是相当之高的。

[root@c12 html]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
[root@c12 html]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
[root@c12 html]# yum install php-mssql
[root@c12 html]# /etc/init.d/httpd graceful

完成。

phpinfo中可以看到mssql的信息

mssql模块实际还是FreeTDS,其功能主要是在Liunx下能够访问Sybase及MS SQL,官方网站是:http://www.freetds.org/ 。当然也可以手工编译mssql模块到php中,不过通过yum更简单一点。

关于epel源,参看这里 http://fedoraproject.org/wiki/EPEL/zh-cn

本方法来源于centOS 6更新yum以便可裝php-mssql (http://blog.hubin411.com/2011/10/13/centos-6%e6%9b%b4%e6%96%b0yum%e4%bb%a5%e4%be%bf%e5%8f%af%e8%a3%9dphp-mssql/) 阅读该页面请自备梯子。或参看如下转录的核心部分:

tep 1:
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm    //取得rpm檔案

step 2:
# rpm -ivh epel-release-6-5.noarch.rpm    //安裝取得的rpm檔案

step 3:
# yum update    //更新yum的資源庫

step 4:
# yum install php-mssql    //安裝php-mssql

step 5:
# service httpd restart    //重啟apache伺服器