NutzCN Logo
问答 NutzSite 二块网卡中只有一块能访问?
发布于 1676天前 作者 loveexception 1699 次浏览 复制 上一个帖子 下一个帖子
标签:

这个是配置文件

#项目启动端口 
server.port=8090


jetty.threadpool.idleTimeout=60000
jetty.threadpool.minThreads=4
jetty.threadpool.maxThreads=8
jetty.page.404=/error/404.html
jetty.page.500=/error/500.html
jetty.page.403=/error/unauth.html
druid.web.filter.principalSessionName=sid


#mysql
jdbc.type=druid
#jdbc.url=jdbc:mysql://localhost:3306/nutzsite?characterEncoding=utf8
jdbc.url=jdbc:mysql://172.16.16.6:3306/nutzsite?characterEncoding=utf8
jdbc.username=root
jdbc.password=123456
jdbc.validationQuery=select 1
jdbc.maxActive=50
jdbc.testWhileIdle=true
jdbc.filters=mergeStat
jdbc.connectionProperties=druid.stat.slowSqlMillis=2000
jdbc.defaultAutoCommit=true




# 同步session到数据库的周期(默认1分钟)
shiro.session.dbSyncPeriod=1

#下面这句必须是绝对路径,这样才能保证开发模式下修改静态文件后进行热更新
#jetty.staticPathLocal=/Users/mocheng/git/tico/projects/configmanager/src/main/resources/static
jetty.staticPathLocal=/Users/maodajun/Documents/project/NB_IOT/NZSIT1.0.2/NutzSite/src/main/resources/static




## kafka 配置
kafka.topic.listen=register
kafka.topic.send=config
kafka.brokers=172.16.16.9:9092
kafka.group=config_manger

启动日志

----------------------------------------------
http.port                                : 8090
http.host                                : localhost
http.idleTimeout                         : 300000
https.enable                             : false
welcome_files                            : index.html,index.htm,index.do
maxFormContentSize                       : 1073741824
----------------------------------------------

怎么才能用二个不同的IP地址访问这个项目呢?

9 回复
server.host=0.0.0.0
http.host=0.0.0.0

使用本机IP访问不到。
404

该网页无法正常运作如果问题仍然存在,请与网站所有者联系。
HTTP ERROR 405

端口没问题:

telnet 192.168.43.12 8090
Trying 192.168.43.12...
Connected to 192.168.43.12.
Escape character is '^]'.
^C^]
telnet> ^C

修改后的配置文件

#项目启动端口
server.port=8090
server.host=0.0.0.0
http.host=0.0.0.0
#tomcat.port=8090
#tomcat.host=0.0.0.0

jetty.threadpool.idleTimeout=60000
jetty.threadpool.minThreads=4
jetty.threadpool.maxThreads=8
jetty.page.404=/error/404.html
jetty.page.500=/error/500.html
jetty.page.403=/error/unauth.html
druid.web.filter.principalSessionName=sid



#mysql
jdbc.type=druid
jdbc.url=jdbc:mysql://localhost:3306/nutzsite?characterEncoding=utf8&useSSL=false
#jdbc.url=jdbc:mysql://172.16.16.9:3306/nutzsite?characterEncoding=utf8
jdbc.username=root
jdbc.password=
jdbc.validationQuery=select 1
jdbc.maxActive=50
jdbc.testWhileIdle=true
jdbc.filters=mergeStat
jdbc.connectionProperties=druid.stat.slowSqlMillis=2000
jdbc.defaultAutoCommit=true

thymeleaf.dialects=nz.net.ultraq.thymeleaf.LayoutDialect
thymeleaf.dialects.shiro=at.pollux.thymeleaf.shiro.dialect.ShiroDialect

shiro.ini.path=shiro.ini

#下面这句必须是绝对路径,这样才能保证开发模式下修改静态文件后进行热更新
#jetty.staticPathLocal=/Users/mocheng/git/tico/projects/configmanager/src/main/resources/static
# jetty.staticPathLocal=/Users/maodajun/Documents/project/NB_IOT/NZSIT1.0.2/NutzSite/src/main/resources/static

#HTML thymeleaf热更新
#thymeleaf.resolver.rootLocal=/Users/maodajun/Documents/project/NB_IOT/NZSIT1.0.2/NutzSite/src/main/resources/template/
#下面这句必须是绝对路径,这样才能保证开发模式下修改静态文件后进行热更新
jetty.staticPathLocal=/Users/maodajun/Documents/project/NB_IOT/NZSIT1.0.2/NutzSite/src/main/resources/static

#swagger
swagger.info.title=后台接口列表
swagger.info.version=1.0.2-Beta
swagger.info.contact.name=maodajun
swagger.info.contact.email=maodj@tico.cn
swagger.info.contact.url=https://tico.cn
swagger.info.license.name=Apache v2
swagger.resource.package=io.nutz.nutzsite.module.api

# 防止XSS攻击
# 过滤开关
xss.enabled =true
xss.excludes = '/favicon.ico,/assets/img/*,/assets/js/*,/assets/css/*'

## activiti 审批流
#activiti.databaseSchemaUpdate=true
#activiti.asyncExecutorEnabled=true
#activiti.asyncExecutorActivate=true

## kafka 配置
kafka.topic.listen=register
kafka.topic.send=config
kafka.brokers=172.16.16.5:9092
kafka.group=config_manger

能出404 405代表能访问呢

server.host=XXX.XX.XX.XX
这样这个IP 就能访问了
应该是这个框架进行绑定IP或域名导制的。
这个绑定是否可以去掉呢?

我就奇怪了, 在阿里云上N个网卡, 写0.0.0.0就没问题的呀...

jetty

    @Override
    @ManagedAttribute("The network interface this connector binds to as an IP address or a hostname.  If null or 0.0.0.0, then bind to all interfaces.")
    public String getHost()
    {
        return _host;
    }

兽总的办法很正确。
我的网络设置的锅。

添加回复
请先登陆
回到顶部