求助:利用Pxory_ajp將Apache和tomcat的整合后jsp頁面的Rewrite設置方法
由於伺服器需要用到JSP和PHP兩種語言,所以我用了Apache的Pxory_ajp功能進行了tomcat的整合。
Php主要用來運行discuz論壇,例如域名為http://bbs.test.com 運行正常,並且rewriet功能正能。
tomcat主要運行網站的主要頁面,例如域名為 http://www.test.com 運行正常,但是文件名的後綴為*.jsp,我希望所以頁面的內容顯示為
*.html,讓搜索引擎更好的搜錄。但是更重要的功能是希望可以實現
二級域名。
比如:http://www.test.com/index.html 顯示的為 http://www.test.com/index.jsp
http://001.test.com/index.html顯示的為 http://www.test.com/user.jsp?id=001
下面是我的伺服器的一些配置文件的內容,
請高手指點,說下有什麼好的解決辦法。謝謝!!
Apache 2.2.3的httpd.conf內容如下:
<Directory "/var/www/bbs">
Options FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/web">
Options FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
Apache 2.2.3的httpd-vhosts.conf內容如下:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin test@163.com
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
ServerName www.test.com
ErrorLog logs/www.test.com-error_log
CustomLog logs/www.test.com-access_log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin test@163.com
DocumentRoot d:/server/web/bbs
ServerName bbs.test.com
ErrorLog logs/bbs.test.com-error_log
CustomLog logs/bbs.test.com-access_log common
</VirtualHost>
tomcat 5.5.20的server.xml配置文件如下:
<Host name="www.test.com">
<Valve className="org.apache.catalina.valves.AccessLogValve" fileDateFormat="yyyy-MM-dd" prefix="www_test_com_access_log."
suffix=".txt"/>
<Context crossContext="true" docBase="/var/www/web" path="" reloadable="true">
</Context>
</Host>
《解決方案》
高手!快出現.....:)
《解決方案》
晚上八點,還是沒有人回答一下.難道要用jk才行嗎?除了jk有沒有其它辦法??
《解決方案》
還沒有解決。。。。哭了..
《解決方案》
http://w.yi.org/ftp/FAPM/apache/Apache2/zh/misc/rewriteguide.html#content
參考:動態鏡像
《解決方案》
比如:http://www.test.com/index.html 顯示的為 http://www.test.com/index.jsp
http://001.test.com/index.html顯示的為 http://www.test.com/user.jsp?id=001
1、
RewriteCond %{REQUEST_URI} /index\.html
RewriteCond %{HTTP_HOST} ^www\.test\.com
RewriteRule ^(.*) /index.jsp
2、
RewriteCond %{REQUEST_URI} /index\.html
RewriteCond %{HTTP_HOST} ^([^&^/])\.test\.com
RewriteRule (.*)/index.html www.test.com/user.jsp?id=%1
大概寫成這樣,只能給你參考一下了。