简体   繁体   English

使用 Tomcat 配置 Apache Web 服务器并尝试部署战争文件

[英]Configure Apache Web Server with Tomcat and trying to Deploy war file

I am not getting my project on my domain name.我没有在我的域名上获得我的项目。 It gives me Apache Test Page instead of my project which i have added in webapps .它给了我 Apache 测试页,而不是我在webapps添加的项目。

I have my war file FINAL_WE.war in /opt/code/apache-tomcat-8.5.54/webapps/我的战争文件FINAL_WE.war/opt/code/apache-tomcat-8.5.54/webapps/

And I have started my tomcat server.我已经启动了我的 tomcat 服务器。 using sh startup.sh from /bin/ folder.使用 /bin/ 文件夹中的sh startup.sh

Log gives me tail -f catalina.out日志给了我tail -f catalina.out

20-Apr-2020 04:06:13.733 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib]
20-Apr-2020 04:06:13.837 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
20-Apr-2020 04:06:13.879 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
20-Apr-2020 04:06:13.909 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1307 ms
20-Apr-2020 04:06:14.001 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
20-Apr-2020 04:06:14.004 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.54
20-Apr-2020 04:06:14.038 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/code/apache-tomcat-8.5.54/webapps/FINAL_WE.war]
20-Apr-2020 04:06:14.602 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/code/apache-tomcat-8.5.54/webapps/FINAL_WE.war] has finished in [564] ms
20-Apr-2020 04:06:14.609 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
20-Apr-2020 04:06:14.623 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 714 ms

I have executed the following commands我已经执行了以下命令

1. cd /usr/local/apache/modules
2. cd /usr/local/apache/conf
3. vim workers.properties

worker.list=we-matter

worker.we-matter.type=ajp13
worker.we-matter.port=8009
worker.we-matter.host=192.169.217.121

4. Apache Web Server file:
vim /usr/local/apache/conf/httpd.conf

LoadModule    jk_module  modules/mod_jk.so

JkWorkersFile  /usr/local/apache/conf/workers.properties

JkLogFile     logs/mod_jk.log
JkLogLevel    emerg
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat     "%w %V %T %p %q %r %v %U"


<VirtualHost *:80>
    ServerName www.we-matter.com
    RewriteEngine on 
    RewriteRule ^/(.*)$ /we-matter/$1 [L,PT]
    JkMount  /* we-matter
</VirtualHost>


6. service httpd stop
     service httpd start


You're creating a named virtual host in Apache httpd.您正在 Apache httpd 中创建一个命名虚拟主机。

<VirtualHost *:80>
    ServerName www.upyourcode.com
    RewriteEngine on 
    RewriteRule ^/(.*)$ /upyourcode/$1 [L,PT]
    JkMount  /* upyourcode
</VirtualHost>

This will cover every request coming in with the Host header to www.upyourcode.com .这将涵盖主机 header 到www.upyourcode.com的每个请求。 Any other host name will fall back to the default virtual host, which likely does not have your JkMount configuration, but is rather configured to the default content, eg httpd's "Success" page, rather than your own content.任何其他主机名将回退到默认虚拟主机,它可能没有您的JkMount配置,而是配置为默认内容,例如 httpd 的“成功”页面,而不是您自己的内容。

You'll need to either configure the default virtual host, add a ServerAlias to the virtual host you mention in this question, or add yet another virtual host with the ServerName that you're expecting to see your content on.您需要配置默认虚拟主机,将ServerAlias添加到您在此问题中提到的虚拟主机,或者添加另一个具有您希望在其上看到内容的ServerName的虚拟主机。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM