我已经获得了一些包含 .jsp 文件的 PHP 项目的源代码。我可以在工作时在我的 Mac 上设置的 XAMPP 上按原样运行它,但我正在努力在家里的 Ubuntu 设置上实现同样的效果。
我需要的是能够在我的 Apache 服务器根目录 (/var/www/html/) 中删除 .jsp 文件,并让 Apache 与 Tomcat 建立任何必要的连接来解析 .jsp 文件并让 Apache 处理其他所有事情。
我不想将我的 .jsp 文件或任何其他文件放在 Tomcat 服务器根目录中,我只是希望 Tomcat 解析我的 Apache 服务器根目录中的 .jsp 文件。
我已经阅读了有关 Stack Exchange 的几篇文章和问题,并取得了以下成果:(localhost/something/something.jsp
位于 中/var/www/html/something/something.jsp
)由 Apache 提供服务,Java 代码未解析地提供给客户端,同时导航到localhost/something/something.php
(位于 something.jsp 旁边)显示默认的“它有效!” Tomcat 的登陆页面。这不是我想要的。
这是我设置了代理的 000-default.conf 文件:
<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 www.example.com
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ProxyRequests off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass *.jsp ajp://127.0.0.1:8009/
ProxyPassReverse *.jsp ajp://127.0.0.1:8009/
<Directory "/var/www/html">
AllowOverride 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>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
我怎样才能达到预期的效果?