简体   繁体   中英

hosting tomcat on mac os

I'm using mini mac and tomcat 7.0.29, I want to host it from my computer so other computer outside the network could connect to it. I have set the port forwarding into 80 both start and end. set static IP on my mini mac. however, after getting the router IP address from ip2location.com and access to it from external computer,it display "it works!" screen, not the tomcat home page. this page is also displayed when I use localhost instead localhost:8080. Here is some snap shot that I've taken from both computer http://i182.photobucket.com/albums/x38/DNK90/staticIP.jpg

http://i182.photobucket.com/albums/x38/DNK90/portforwarding.jpg

And this one is from external computer

i182.photobucket.com/albums/x38/DNK90/tomcat.jpg

anybody who know how to access directly to the localhost:8080 through router IP, tell me ^^

Well the problem is, that on port 80 the apache is being called for an answer. You will have to configure your NAT a bit different. Either you find an option on your router to forward every call to port 80 to port 8080 on your mac mini or you use ipfw (on linux machines you would use iptables). Try

sudo ipfw add fwd 127.0.0.1,80 tcp from me to 127.0.0.1 dst-port 8080

I do not have a mac in front of me right now, so this command is untested, but I think it will work.

Ps. Once I get home, I'll test the command and edit this post.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM