一、tomcat和nginx 配置
/etc/nginx/conf.d/default.conf
location /nsx{
proxy_pass http://nsx;
proxy_connect_timeout 30s;
springboot rest,proxy_read_timeout 30s;
proxy_send_timeout 30s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
upstream nsx{
/rest,ip_hash;
server 10.15.21.134:8095;
2、tomcat 配置 server.xml ,3個端口。
二、工程注意點
/opt/skyform/skyform-cmdb/webapps/cmdbapi
1、tomcat 下 war包解壓后文件夾名稱 必須與nginx配置文件
rest怎么打開。/etc/nginx/conf.d/default.conf 定義一致
location /cmdbapi{
2、 http://physical; 是工程包名稱
http://localhost:8080/cmdbapi/network/test
network/test 在控制層 代碼設置。
3、如果war包是 ROOT.war(不帶版本號)放入tomcat
client,則沒有工程名,http url 訪問時,
則需要在 工程代碼的控制類中 設置 /nsx/network/test
(要包含工程url)
http://localhost:8080/nsx/network/test
4、url訪問測試前,必須確保tomcat啟動正常,linux下必須查看tomcat 日志文件
定位日志
java調用webservice接口 三種方法?/var/log/nginx/error.log
/tomcat/logs/catalina.log
三、使用 restclient 工具 訪問rest接口
1、get 一般獲取查詢接口,不用設置body
2、post訪問
設置消息頭 ?Content-Type=application/json
jdbc connection will not be。發送body設置 json格式
{
"accountId": "jyjtest1"
}
響應body:json格式
{
idea rest client?"msg": "lstAllEdge is empty.",
"networkid": "",
"success": "fail"
}
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态