Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

147
Views
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.

I have my war file FINAL_WE.war in /opt/code/apache-tomcat-8.5.54/webapps/

And I have started my tomcat server. using sh startup.sh from /bin/ folder.

Log gives me 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


9 months ago · Santiago Trujillo
1 answers
Answer question

0

You're creating a named virtual host in 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. 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, e.g. httpd's "Success" page, rather than your own content.

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.

9 months ago · Santiago Trujillo Report
Answer question
Find remote jobs