在mac系統(tǒng)做開發(fā),有時候需要用到80端口,但是由于系統(tǒng)原因,1024以下需要root權(quán)限,網(wǎng)絡(luò)上的解決辦法:
1.直接用root啟動tomcat;但是不能用eclipse debug;
2.用pf(pfctl)設(shè)置端口轉(zhuǎn)發(fā),把80端口請求轉(zhuǎn)發(fā)到8080.
經(jīng)本人測試,停用pf,改用apache或者nginx來轉(zhuǎn)發(fā)80請求!
注意,如果eclipse啟動tomcat時卡在eclipse preparing launch delegate...
然后報錯:
Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
可能是你之前設(shè)置過pf,這時候把pf停用了就可以了:sudo pfctl -d
啟用sudo pfctl -e