doulian5857
2014-01-03 18:52
浏览 50
已采纳

在同一个应用程序中使用JSP和PHP

My application is based on PHP. Now I want to integrate a web-reporter which is written in JSP. So, I have an Apache HTTP Server and an application written in PHP. I even installed Tomcat to serve JSP files and it is running well at 8080 port. I also got mod_jk.so and added a line LoadModule jk_module modules/mod_jk.so to httpd.conf file, but still I can't run JSP files from my application folders (port 80). I guess, there should be extra tuning of httpd.conf file, but I do not know, what exactly should be done.

EDIT My workers.properties looks exactly like this

JkWorkerProperty worker.list=ajp13w
JkWorkerProperty worker.ajp13w.type=ajp13
JkWorkerProperty worker.ajp13w.host=localhost
JkWorkerProperty worker.ajp13w.port=8009

My uriworkermap.properties looks like this

/jsp/*=ajp13w

where jsp is a folder in htdocs, containing jsp files

And finally, my httpd.conf now contains

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule jk_module modules/mod_jk.so

#AddModule     mod_jk.c
#JkWorkersFile C:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/workers.properties
#JkMountFile   C:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/uriworkermap.properties
JkLogFile     C:/Apache/logs/mod_jk.log
JkLogLevel    info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

Each commented line makes it impossible to start the server.

EDIT

I installed a newer version of Tomcat - Tomcat 8.0, but the problem remains unsolved.

EDIT

Judging by this link apache.org, the problem can be solved by changing server.xml (of tomcat) and some changes of httpd.conf (concerning virtual host). But as allways in this world, this article does not provide any concrete examples.

EDIT

I moved one step ahead. The most stupid error which made it impossible to run the server was quotes. So this line in httpd.conf - JkWorkersFile C:/Program Files/Apache Software Foundation/Tomcat 8.0/conf/workers.properties gave me an error, but after three hours of struggle it turned out, that it should be JkWorkersFile "C:/Program Files/Apache Software Foundation/Tomcat 8.0/conf/workers.properties". So, now it runs. However, when I go to localhost/jsp/index.jsp I now see an Apache Tomcat error report: HTTP Status 404 - /jsp/index.jsp. This seems to be the last error, but still I do not know how to deel with it.

EDIT

Now I see it works. Though, I get an unexpected behaviour. I thought I could place JSP files inside htdocs folder, but as it turned out, they should be placed inside tomcat.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新