- 浏览: 295851 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (155)
- Liferay portal研究 (23)
- spring研究 (7)
- Displaytag (2)
- Flash Builder (0)
- 搜索引擎 (12)
- 杂项 (17)
- SCM管理 (7)
- Jquery (5)
- Linux (7)
- Oracle (10)
- httpd集成 (3)
- Maven2 (5)
- 企业管理 (1)
- tomcat高级 (4)
- dos命令 (1)
- ldap (2)
- Java (8)
- webservice (1)
- jetty代码研究 (3)
- OpenCMS (1)
- JMX (2)
- hibernate (5)
- Ant (1)
- js tree (4)
- Quartz (0)
- CMS (1)
- springside (1)
- proxool (1)
- freemarker (1)
- Cookie (1)
- CAS SSO (4)
- mysql (1)
- php (1)
- js (2)
- Asset (1)
- openmeeting (1)
- h2数据库 (2)
- wcf vs java ws (1)
最新评论
-
22199143:
...
当在重启Tomcat容器时 Exception in Thread "HouseKeeper" java.lang.NullPointerException -
liuqq:
一直用Oracle开发,几乎没有接触过其他数据库。使用Mysq ...
The Nested Set Model -
yjsxxgm:
yjsxxgm 写道FFFFFFFFFFFFFFFWWW
java 访问wcf -
yjsxxgm:
FFFFFFFFFFFFFFF
java 访问wcf -
hjp222:
scanIntervalSeconds 是重新启动,并非真正的 ...
Jetty 热部署
Some parameters should be modified in the following file ? include_php/parametres.php ?
line 25 : $mysql_db = "subpro"; // the mysql database name
line 27 : $mysql_hostname = "localhost"; // host for database server
line 28 : $mysql_login = "subpro"; // login
line 29 : $mysql_password = '***********************'; // the password
line 35 : $base = "<base href=\"http://www.subpro.com/\" >"; // the base html tag used in subpro's site.
$mysql_db_stat are not used in chinese version.
==============================================================
如果你的服务器apache还没有安装,那很简单,在编译apache时将 mod_rewrite模块编译进去就可以,相关文档可以在http://man.chinaunix.net/newsoft … ew/mod/mod_rewrite. html中找到。如果你的apache已经安装好了,现在只想编译出mod_rewrite.so模块,在apache中进行加载,下面我们就介绍这个方 法。
以Fedora操作系统进行举例:
1)首次安装apache,在编译时增加–enable-rewrite选项。
如./configure –prefix=/opt/apache –enable-so –enable-mods-shared=all –enable-rewrite –enable-cache
2)增加mod_rewrite模块
# find . -name mod_rewrite.c //在apache的源码安装目录中寻找mod_rewrite.c文件
(2.2.8在目录httpd-2.2.8/modules/mappers下,我找了半天才找到的)
# cd PATH/to/mod_rewrite.c //进入包含mod_rewrite.c文件的目录
# /opt/apache/bin/apxs -c mod_rewrite.c //apxs应指定绝对路径,在你当前正在使用apache的bin目录里
# /opt/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.la
如果没有什么错误的话,应该在你的apache的modules目录中编译出一个mod_rewrite.so文件。
编辑httpd.conf文件,确认httpd.conf中已经包含mod_rewrite.so的加载语句,如下:
LoadModule rewrite_module modules/mod_rewrite.so
检查:
[root@www httpd-2.2.8]# ../bin/apachectl configtest
Syntax OK
这时,你的apache应该已经支持rewrite了。
vicos注:完成之后,记得重启服务器apache。
注意下一步,配置虚拟主机的时候要类似如下设置才可以生效:
<VirtualHost *:80>
DocumentRoot /var/www/www/www.fastu.cn/
ServerName www.fastu.cn
<Directory /var/www/www/www.fastu.cn/>
Options FollowSymLinks
AllowOverride All
order allow,deny
Allow from all
</Directory>
</VirtualHost>
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
安装环境:rhel es 4
apache:1.3.37(源码自己编译安装)
gdbm:1.8.3
1. Apache安装rewrite模块的时候需要DBM支持,否则无法编译,表现为:
[nemo@web standard]$ ~/apache/bin/apxs -c mod_rewrite.c
gcc -DLINUX=22 -DHAVE_SET_DUMPABLE -DUSE_HSREGEX -fpic -DSHARED_MODULE -I/home/nemo/apache/include -c mod_rewrite.c
In file included from mod_rewrite.c:51:
mod_rewrite.h:91:18: ndbm.h: No such file or directory
mod_rewrite.c: In function `lookup_map_dbmfile':
mod_rewrite.c:3035: error: `DBM' undeclared (first use in this function)
mod_rewrite.c:3035: error: (Each undeclared identifier is reported only once
mod_rewrite.c:3035: error: for each function it appears in.)
mod_rewrite.c:3035: error: `dbmfp' undeclared (first use in this function)
mod_rewrite.c:3036: error: `datum' undeclared (first use in this function)
mod_rewrite.c:3036: error: syntax error before "dbmkey"
mod_rewrite.c:3044: error: `dbmkey' undeclared (first use in this function)
mod_rewrite.c:3047: error: `dbmval' undeclared (first use in this function)
apxs:Break: Command failed with rc=1
[nemo@web standard]$ rpm -qa |grep gdbn
[nemo@web standard]$ rpm -qa |grep gdbm
gdbm-1.8.0-24
gdbm-devel-1.8.0-24
所以首先要安装一个GDBM :下载地址:ftp://ftp.gnu.org/gnu/gdbm/
GDBM安装步骤: 进入安装目录,
./configure
make
make install
make install-compat #否则无法编译出ndbm.h头文件.
2. 然后进入到apache源码包解压目录apache_1.3.37/src/modules/standard,用Apache bin目录下的apxs命令安装,注意apxs使用绝对路径:
cd /path/to/apache_1.3.37/src/modules/standard/
/usr/local/apache/bin/apxs -c mod_rewrite.c
/usr/local/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.so
然后在http.conf配置文件里加上:
LoadModule rewrite_module libexec/mod_rewrite.so
接下来用
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start
停止apache,然后用再start,千万注意,在这里不能用restart或者graceful参数来重新启动apache,必须先停止,然后再开始,否则rewrite将不起作用。
如果你跟我一样的不幸,遇到dbm_fetch错误问题,那么请按我的尝试来操作:
执行完/usr/local/apache/bin/apxs -i -a -n mod_rewrite mod_rewrite.so后,这个命令已经帮我们复制mod_rewrite.so模块到libexec目录下并且修改好了httpd.conf文件,但测试却出现dbm_fetch错误:
[root@web conf]# ../bin/apachectl configtest
Syntax error on line 16 of /home/nemo/apache/conf/httpd.conf:
Cannot load /home/nemo/apache/libexec/mod_rewrite.so into server: /home/nemo/apache/libexec/mod_rewrite.so: undefined symbol: dbm_fetch
google一下,马上发现一篇文章写有解决方法(本文最后贴出),继续尝试:
到 apache_1.3.37/src/modules/standard 目录,执行一下这个命令:
gcc -shared -o mod_rewrite.so mod_rewrite.o -lgdbm
cp mod_rewrite.so /usr/local/apache/libexec/
重新检查一下:
[root@web conf]# ../bin/apachectl configtest
Syntax error on line 16 of /home/nemo/apache/conf/httpd.conf:
Can't locate API module structure `mod_rewrite_module' in file /home/nemo/apache/libexec/mod_rewrite.so: /home/nemo/apache/libexec/mod_rewrite.so: undefined symbol: mod_rewrite_module
修改 httpd.conf ,将
LoadModule mod_rewrite_module libexec/mod_rewrite.so
改为
LoadModule mod_rewrite libexec/mod_rewrite.so
检查一下:
[root@web conf]# ../bin/apachectl configtest
Syntax error on line 16 of /home/nemo/apache/conf/httpd.conf:
Can't locate API module structure `mod_rewrite' in file /home/nemo/apache/libexec/mod_rewrite.so: /home/nemo/apache/libexec/mod_rewrite.so: undefined symbol: mod_rewrite
靠!再改:
LoadModule rewrite_module libexec/mod_rewrite.so
检查:
[root@web conf]# ../bin/apachectl configtest
Syntax OK
NND,总算搞定了!
[root@web conf]# ../bin/apachectl restart
../bin/apachectl restart: httpd restarted
-------------------------------------
google到的解决方法:
http://www.vttoth.com/rewrite.htm
Technical Notes: Undefined symbol 'dbm_fetch' with the Apache server
I tried to include in my Apache Web server's configuration the mod_rewrite module, but when I restarted the server, I received an error:
Cannot load /usr/local/apache/libexec/mod_rewrite.so into server:
/usr/local/apache/libexec/mod_rewrite.so: undefined symbol: dbm_fetch
The problem, as it turns out, is that mod_rewrite.so is compiled incorrectly. It should be linked with a dbm library but it isn't.
If you have an up-to-date set of Apache source files, you can easily solve this problem by manually rerunning the last compilation step of this module, using the correct options. When you execute make mod_rewrite.so in the appropriate directory, it performs this final step:
gcc -shared -o mod_rewrite.so mod_rewrite.lo
Rerun gcc, this time adding a reference to the GNU gdbm library:
gcc -shared -o mod_rewrite.so mod_rewrite.lo -lgdbm
Next, copy the newly created mod_rewrite.so over to /usr/local/apache/libexec or wherever your Apache module files are located.
In my case, this was all that was needed to solve the problem. Your mileage may vary.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
==============================================================
查看linux版本
1) [root@q1test01 ~]# cat /proc/version
Linux version 2.6.9-22.ELsmp (bhcompile@crowe.devel.redhat.com) (gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)) #1 SMP Mon Sep 19 18:00:54 EDT 2005
2) [root@q1test01 ~]# uname -a
Linux q1test01 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:00:54 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux
3) [root@q1test01 ~]# uname -r
2.6.9-22.ELsmp
2.查看linux的版本主要有三种方法:
1) 登录到服务器执行 lsb_release -a ,即可列出所有版本信息,例如:
[root@3.5.5Biz-46 ~]# lsb_release -a
LSB Version: 1.3
Distributor ID: RedHatEnterpriseAS
Description: Red Hat Enterprise Linux AS release 4 (Nahant Update 1)
Release: 4
Codename: NahantUpdate1
[root@3.5.5Biz-46 ~]#
这个命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版。
2) 登录到linux执行cat /etc/redhat-release ,例如如下:
[root@3.5.5Biz-46 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 1)
[root@3.5.5Biz-46 ~]#
这种方式下可以直接看到具体的版本号,比如 AS4 Update 1
3)登录到linux执行rpm -q redhat-release ,例如如下
[root@3.5.5Biz-46 ~]# rpm -q redhat-release
redhat-release-4AS-2.4
[root@3.5.5Biz-46 ~]#
这种方式下可看到一个所谓的release号,比如上边的例子是2.4
这个release号和实际的版本之间存在一定的对应关系,如下:
redhat-release-3AS-1 -> Redhat Enterprise Linux AS 3
redhat-release-3AS-7.4 -> Redhat Enterprise Linux AS 3 Update 4
redhat-release-4AS-2 -> Redhat Enterprise Linux AS 4
redhat-release-4AS-2.4 -> Redhat Enterprise Linux AS 4 Update 1
redhat-release-4AS-3 -> Redhat Enterprise Linux AS 4 Update 2
redhat-release-4AS-4.1 -> Redhat Enterprise Linux AS 4 Update 3
redhat-release-4AS-5.5 -> Redhat Enterprise Linux AS 4 Update 4
注意:第(2)(3)两种方法只对Redhat Linux有效
========================================================================
/apache/httpd/modules/mappers
/apache/httpd/bin/apxs -c mod_rewrite.c
/apache/httpd/bin/apxs -i -a -n mod_rewrite mod_rewrite.la
LoadModule rewrite_module modules/mod_rewrite.so
=========================================================================
http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html
If you are looking for the examples of URL rewriting then this post might be useful for you. In this post, I’ve given five useful examples of URL rewriting using .htacess. If you don’t know something about url rewriting then please check my older post about url rewriting using .htaccess.
Now let’s look at the examples
1)Rewriting product.php?id=12 to product-12.html
It is a simple redirection in which .php extension is hidden from the browser’s address bar and dynamic url (containing “?” character) is converted into a static URL.
RewriteEngine on
RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1
2) Rewriting product.php?id=12 to product/ipod-nano/12.html
SEO expert always suggest to display the main keyword in the URL. In the following URL rewriting technique you can display the name of the product in URL.
RewriteEngine on
RewriteRule ^product/([a-zA-Z0-9_-]+)/([0-9]+)\.html$ product.php?id=$2
3) Redirecting non www URL to www URL
If you type yahoo.com in browser it will be redirected to www.yahoo.com. If you want to do same with your website then put the following code to .htaccess file. What is benefit of this kind of redirection?? Please check the post about SEO friendly redirect (301) redirect in php and .htaccess.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^optimaxwebsolutions\.com$
RewriteRule (.*) http://www.optimaxwebsolutions.com/$1 [R=301,L]
4) Rewriting yoursite.com/user.php?username=xyz to yoursite.com/xyz
Have you checked zorpia.com.If you type http://zorpia.com/roshanbh233 in browser you can see my profile over there. If you want to do the same kind of redirection i.e http://yoursite.com/xyz to http://yoursite.com/user.php?username=xyz then you can add the following code to the .htaccess file.
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1
5) Redirecting the domain to a new subfolder of inside public_html.
Suppose the you’ve redeveloped your site and all the new development reside inside the “new” folder of inside root folder.Then the new development of the website can be accessed like “test.com/new”. Now moving these files to the root folder can be a hectic process so you can create the following code inside the .htaccess file and place it under the root folder of the website. In result, www.test.com point out to the files inside “new” folder.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.test\.com$
RewriteCond %{REQUEST_URI} !^/new/
RewriteRule (.*) /new/$1
Popularity: 88% [?]
=====================================================================================
RewriteEngine On
RewriteBase /
RewriteRule ^(space|network)\-(.+)\.html$ $1.php?Rewrite=$2 [L]
RewriteRule ^(space|network)\.html$ $1.php [L]
RewriteRule ^([0-9]+)$ space.php?uid=$1 [L]
-----
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)\.html$ $2.php?lang=$1
.htaccess
RewriteRule ^product-([0-9]+)\.html$ product.php?id=$1
<Directory "C:/supersoft/www/subpro/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</Directory>
<VirtualHost *:80>
ServerAdmin dx_andy@163.com
DirectoryIndex index.html index.htm index.php
DocumentRoot C:/supersoft/www/subpro/
ServerName www.test.com
ErrorLog C:/supersoft/www/subpro/demo1-error_log
CustomLog C:/supersoft/www/subpro/demo1-access_log common
</VirtualHost>
/apache/prepro/subpro
====================================
<VirtualHost *:80>
DocumentRoot /apache/prepro/subpro/
ServerName www.subpro.com.cn
<Directory /apache/prepro/subpro/>
Options FollowSymLinks
AllowOverride All
order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /apache/prepro/
ServerName www.prepro.com.cn
<Directory /apache/prepro/>
Options FollowSymLinks
AllowOverride All
order allow,deny
Allow from all
</Directory>
</VirtualHost>
相关推荐
在IT行业中,PHP虚拟主机配置是一项基础且重要的工作,它涉及到服务器环境的搭建、网站的多域名管理和URL重写等功能。下面将详细讲解如何配置基于域名的PHP5.0虚拟主机。 首先,我们需要确保Apache服务器已经安装...
配置Apache时,我们需要修改httpd.conf配置文件,比如设置监听端口、虚拟主机、DocumentRoot(网站根目录),以及配置PHP模块(mod_php)。 **Tomcat**:虽然标题中提到了Tomcat,但通常在LAMP/WAMP环境中,我们不...
用户可能需要修改Apache的配置文件(如httpd.conf)以适应自己的需求,例如设置虚拟主机、调整服务器监听端口等。 总的来说,这个组合包为Web开发者提供了一个快速启动和调试PHP应用的环境,无需复杂的安装步骤,...
- **配置文件**:主要配置文件为`httpd.conf`,其中包含了服务器的基本设置,如监听端口、虚拟主机等。 - **启动与管理**:使用`srvctl`或`apachectl`命令来启动、停止、重启和检查Apache服务状态。 3. **虚拟...
它支持多种功能和模块,如URL重写(通过mod_rewrite模块),虚拟主机(allowing multiple websites on a single server),以及SSL/TLS加密(通过mod_ssl模块)以实现HTTPS连接。`httpd.conf`是Apache的主要配置文件...
3. **模块管理**:熟悉Apache的模块化架构,如mod_rewrite用于URL重写,mod_php用于PHP集成,以及如何启用和禁用模块。 4. **URL重写**:通过学习mod_rewrite模块,掌握如何使用正则表达式实现URL美化,提升网站SEO...
通过使用NameVirtualHost指令和ServerName,可以轻松设置和管理虚拟主机。 **4. SSL/TLS 安全** Apache 2.2.32支持SSL/TLS协议,允许通过HTTPS提供安全的网页浏览。管理员需要为每个网站配置SSL证书,以加密用户与...
通过设置ServerName和ServerAlias,可以定义每个虚拟主机的域名或IP地址。使用`<VirtualHost>`指令进行配置,确保每个虚拟主机有独立的DocumentRoot(文档根目录)。 四、安全与权限 Apache2的安全性至关重要,可以...
4. **模块管理**:Apache 提供许多模块,如 mod_rewrite 用于 URL 重写,mod_deflate 用于内容压缩,根据需求进行加载和配置。 5. **PHP 扩展**:PHP 有很多扩展,如 PDO、mysqli、gd 等,根据应用需求安装和启用。 ...
7. **环境设置**:根据项目需求,可能需要调整PHP配置(如php.ini),或者在Apache的httpd.conf文件中配置虚拟主机。 通过这个三件套,你可以快速地在本地搭建一个Web开发环境,进行PHP编程和MySQL数据库管理的学习...
Apache24的主要功能包括处理HTTP请求、管理虚拟主机、支持多种模块(如mod_rewrite用于URL重写)以及提供高可用性和安全性。Apache24的2.4版本引入了许多改进,例如更好的性能、资源管理和模块化设计,使得配置更加...
安装时,需要注意配置httpd.conf文件以设定服务器的基本参数,如监听端口、文档根目录、虚拟主机等。 MySQL-essential-5.0.51是MySQL的一个特定版本,包括了MySQL服务器、客户端工具以及必要的库文件。5.0版是MySQL...
此外,Apache的配置文件(httpd.conf)允许开发者灵活定制服务器行为,如设置虚拟主机、重定向规则等,以适应不同PHP应用的需求。 在Apache2.0中,还有几个关键特性值得一提: 1. **多线程模型**:Apache2.0引入了...
1. PHP/Python/Perl集成:通过mod_php、mod_wsgi等模块运行动态脚本。 2. 数据库支持:使用mod_dbd或特定模块连接MySQL、PostgreSQL等数据库。 通过深入理解和实践这本手册中的内容,系统管理员可以有效地管理...
它的配置文件通常为`httpd.conf`,在这里可以设置服务器的行为、虚拟主机、访问控制等。 二、工作原理 Apache服务器接收到请求后,会解析URL并根据配置确定应服务的文件或应用程序。它支持多种模块,如mod_rewrite...
Apache支持多个虚拟主机在同一台服务器上运行,这意味着你可以用一个服务器托管多个独立的网站,每个网站拥有不同的域名和配置。 5. **权限管理** Apache提供了基于用户和组的权限控制,可以限制对特定目录或文件...
配置项包括但不限于:监听端口、服务器标识、虚拟主机设置、日志文件路径、文档根目录等。`VirtualHost`指令用于定义多个独立的网站,每个网站有自己的域名和目录。`Directory`指令则用来设置特定目录的访问权限和...
要让JSP、ASP、PHP都能通过80端口响应,需要正确配置服务器的虚拟主机或者路径映射,确保每个技术的请求能够被正确路由。 6. **IIS与Apache**: 如果服务器使用的是IIS,ASP的集成较为自然,但JSP和PHP可能需要...
9. **动态内容支持**:除了PHP和Perl,Apache还支持Python、Ruby等其他脚本语言,以及Java的Tomcat和Jetty等应用服务器,通过mod_jk或mod_proxy_ajp模块进行集成。 10. **错误处理**:Apache允许自定义错误页面,以...
手册会介绍如何启用或禁用模块,比如mod_rewrite用于URL重写,mod_security用于增强服务器安全,mod_deflate用于内容压缩,以及mod_proxy和mod_proxy_http用于代理和负载均衡。每个模块的配置选项和使用场景都会得到...