Problems encountered under Linux

On linux, we often do not directly use the root user to start the user's application, but create a new user to manage the application.

Check port forwarding:

iptables -t nat -L -n  | grep 80

 

For example, after the tomcat application is started by an ordinary user, if you request to directly access port 80 or port 443, it cannot reach tomcat, because there is no permission to access ports below 1024. Our common solution is to add routing rules, forward requests from port 80 to port 8000, and let tomcat listen directly to port 8000. The execution command is:

iptables -A PREROUTING -t nat -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8000

The network card is eth1. Note: The Alibaba Cloud server has two network cards, and eth0 is bound to the intranet address.

Similarly, port 443 can be obtained:

iptables -A PREROUTING -t nat -i eth1 -p tcp --dport 443 -j REDIRECT --to-port 8443

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327041565&siteId=291194637