简体   繁体   中英

How can I change the portnumber (example.com:1234) to something like (example.com)?

I am running a web application on Ubuntu, and serve it with http-server. Because there are more instances of this application running (with some differences between the instances), most of them have a portnumber behind them. However, I would like to have one root web application which now runs on example.com:1234 to be accesible on example.com

Are there any other ways to make this possible?

I have tried using the --proxy flag of http-server, but I can't seem to make the URL work. There is another package called http-proxy, but this would take some time to make it work (extra code). I hope there is a simpler solution than installing another node package.

Well I don't think you could change the port number, but if you want to change the host name you could just do the following,

/etc/hosts (or it's equivalents on other OS's) is used to resolve hostnames to some ip without asking to dns servers.

You can use in your /etc/hosts:

127.0.0.1 myserver.com

And then open http://myserver.com:3333 in your browser and it will connect to 127.0.0.1 to 3333 port.

I am talking about things locally. Otherwise host your server and bind it using ngnix.conf or IP tables.

如果root web应用程序已在运行,如果它有助于更​​改端口号,则可以将其更改为端口号example.com:80,以便在使用example.com访问URL时自动获取它。

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