How to replace Aliyun domain name to static ip and hide port by nginx

now port 80 in Aliyun is occupied, and the domain name defaults to port 80, but I use 8081 for tomcat. Can I use the nginx to reverse the domain name to the native ip:8081, and hide the 8081 that the domain name needs to bring

?
Apr.02,2021

Yes, you can first take a look at the concept of nginx virtual host. Nginx listens on port 80, but there can be multiple sites, so you can ask, nginx reverse proxy to 8081, the domain name does not need to take 8081 is just your hidden domain name?


you can add an individual name to your tomcat (set context in server.xml), for example, the original www.aa.com can be set to www.aa.com/alias.
then nginx agent www.aa.com/alias port 80 of this path, mapped to 8081

Menu