I started a Grails app listening to the default port 8080, as well as running grails as root to listen at port 80:
#grails -Dserver.port=80 run-app开发者_JAVA技巧
This works perfectly well on localhost, but when I access it from an external IP address, it just fails to work. Just to be sure, I have Apache running on the same server and I can access it perfectly fine over the Internet.
Is there some configuration option I am missing here to ask Grails to listen on all IP addresses?
I even tried this but to no avail:
#grails -Dserver.host=0.0.0.0 -Dserver.port=80 run-app
I am using Grails 1.4.0M1 on Ubuntu 10.04 on an EC2 instance.
Thanks in advance.
Hanxue
If you really want to run it with run-app, the enter your servers IP address in your command-line, like this:
#grails -Dserver.host=xx.xx.xx.xx -Dserver.port=80 run-app
But you will probably find that you get a conflict with your Apache server running on the same IP.
I think you should look into using mod_proxy and mod_proxy_apj to "hide" your grails server beghind your Apache server
As cjstehno noted, in production you should run the app as a war deployed to an AppServer (Tomcat, TCServer, etc) And ideally have that running behind a WebServer (Apache) to route traffic.
See --> http://grails.org/doc/latest/guide/17.%20Deployment.html
if you are on ec2, make sure that the firewall has port 80 opened up to the world (or whatever ip you are connecting from). this is not the default and trips up many first time users of ec2.
精彩评论