問題描述
添加一個新模塊,部署在服務器上。服務器上還部署有其他模塊且訪問正常,新模塊和其他模塊共用同一個域名。服務部署之后,請求如下:
http://my.domain.com/test/index.jsp
返回
Not Found
The requested URL /test/index.jsp was not found on this server.
解決步驟
- 登入服務器,查看tomcat的webapp目錄下,發現有test目錄和/test/index.jsp文件。
- 查看/tomcat/conf/server.xml中connector的配置:
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
- 本地訪問嘗試:
http://localhost:8080/test/index.jsp 正常
http://localhost:80/test/index.jsp Not Found
http://my.domain.com:8080/test/index.jsp 正常
http://my.domain.com:80/test/index.jsp Not Found
得出結論,端口號與模塊匹配有限制。
- http服務使用的是apache,網上搜索關於apache多端口多目錄的配置方法。找到配置文件后參照之前模塊的格式進行配置。
- /cong/httpd.conf 文件中,確保這句
Include conf/extra/httpd-vhosts.conf
沒有被注釋掉。 - 然后打開/conf/extra/httpd-vhosts.conf 文件查看配置,參照之前的配置,如下:
<VirtualHost *:80>
ServerName my.domain.com
ProxyRequests Off
<Location /test>
ProxyPass balancer://test/
ProxyPassReverse balancer://test/
</Location>
<Proxy balancer://test>
Order Deny,Allow
Allow from all
BalancerMember http://127.0.0.1:8080/test
ProxySet lbmethod=byrequests
</Proxy>
</VirtualHost>
- 重啟apache服務器
./apachectl restart
返回:
httpd not running, trying to start
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
命令: sudo ./apachectl restart
返回:
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
命令:sudo killall httpd
sudo:killall:找不到命令
ps axu| grep httpd
sudo kill -9 365 355 367 383 398 //刪除這些httpd進程
sudo ./apachectl start 啟動成功