开发者

Accessing running Grails application from a remote machine

I'm developing a Grails application to a school work. Typically, this is the URL for any server running on a local machine:

http://localhost:8080/ProjectName

After I run tomcat server with my Grails project, I go to that location and I can acess the website. But, as far as I know, ev开发者_如何学JAVAeryone in my LAN should be able to load the website from same URL (http://localhost:8080/ProjectName). As I have two computers on same lan via router, I tried to acess my website and it doesnt seems to be working. How can access the application from another computer? If possible, suggest a website that I can read and learn stuff about this matter, cause my lack of knowledge about servers is so dramatic.


If you want your local development instance to be available to other machines on your network, start grails like this:

grails -Dgrails.server.host=0.0.0.0 run-app

Then you can get your own IP address from ipconfig or ifconfig as described in another answer. You can then access your application from another machine. Make sure your local firewall is not blocking 8080 (or whatever other port you've decided to start grails on)


You need to use your machine's hostname or IP to access it from another machine.

You can get this information from a command prompt:

Windows

C:\>hostname
yourhostname

C:\>ipconfig
...
IPv4 Address. . . . . . . . . . . : 192.168.x.x

Linux (usually)

$ hostname
yourhostname

$ ifconfig
...
inet.addr:192.168.x.x

You can use either of those to get to it from another machine, e.g.

http://yourhostname:8080/YourApplication

or

http://192.168.x.x:8080/YourApplication
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜