簡體   English   中英

在Ubuntu 12.04上使用mod_jk的Tomcat 7和Apache2

[英]Tomcat 7 and Apache2 with mod_jk on Ubuntu 12.04

我安裝了tomcat並測試正常后,嘗試在Ubuntu 12.04上使用mod_jk安裝Tomcat 7和Apache2。

http://139.162.221.XXX:8080/tomcat-demo/helloworld/

我安裝並配置了mod_jk:

sudo apt-get install libapache2-mod-jk

在文件etc / tomcat7 / server.xml中取消注釋以下行<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

添加:

# Define 1 real worker using ajp13 
worker.list=worker1 
# Set properties for worker (ajp13) 
worker.worker1.type=ajp13 
worker.worker1.host=localhost
worker.worker1.port=8009

到/etc/apache2/workers.properties

將文件/etc/apache2/mods-available/jk.conf中的JkWorkersFile屬性更改為/etc/apache2/workers.properties

編輯文件:/ etc / apache2 / sites-enabled / 000-default

加上

<VirtualHost *:80>
.......................................
.......................................
JkMount /tomcat-demo/* worker1
JkMount /tomcat-demo worker1
</VirtualHost *:80>

重新啟動服務器:

sudo /etc/init.d/tomcat7 restart
sudo /etc/init.d/apache2 restart

但正在訪問http://139.162.221.XXX/tomcat-demo/helloworld/

我收到此錯誤:

Not Found

The requested URL /tomcat-demo/helloworld/ was not found on this server.

Apache/2.4.7 (Ubuntu) Server at 139.162.221.107 Port 80

而且我也有此錯誤重新啟動Apache:

 * Restarting web server apache2                                                                                                                                 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message

不確定通配符解析的實際操作方式,我通常有兩個JkMounts:

JkMount /tomcat-demo   worker1
JkMount /tomcat-demo/* worker1

(這可能是多余的,但我比您引用的聲明更喜歡此聲明,該聲明還包括/tomcat-demo7和其他路徑)

另外,請確保沒有多個VirtualHost聲明,並且只有某個主機名實際上具有JkMount活動狀態。 確保您的worker.properties實際上已被讀取(日志文件,或引入語法錯誤並確保已被識別)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM