How to run meteor on a different port

杀马特。学长 韩版系。学妹 提交于 2020-01-01 05:05:10

问题


How to run meteor on a different port, for example on port 80. I tried to use meteor --port 80, but I get this error Error: listen EACCES

help me please.


回答1:


Sounds like it might be access issue on your machine.

Check out this following answer, which might be related to your question. Quoting:

"As as a general rule processes running without root privileges cannot bind to ports below 1024.

So try a higher port, or run with elevated privileges via sudo."

So, you can see that sudo meteor run with your port number will work, but that you can address the root cause, which is fixing the node root privilege.

Node.js EACCES error when listening on most ports




回答2:


You can't bind to ports < 1024 on Linux/Unix operating systems with a non-privileged account.

You could get around this by running meteor as root, but this is a really bad idea. In development mode, running as root will modify the permissions of the files under your application directory. In production, it's just a giant security hole. Never run a meteor app as root.

Listed below are the best practices depending on your environment.

Development

Run meteor on a high port number. The default is 3000 when you don't give a --port argument. Connect to it via the URL printed in the console - e.g. http://localhost:3000/.

Production

Here you have two choices:

  • Run meteor on a high port number and connect it to the outside world via a reverse proxy like nginx or HAProxy.

  • Start the webserver as root but step down the permissions once it's running using something like userdown. This is how mup works which, incidentally, is probably what you should be using to deploy your app.




回答3:


run it with sudo

sudo meteor --port 80



回答4:


You can use meteor run --port 8080, it's work...



来源:https://stackoverflow.com/questions/28027454/how-to-run-meteor-on-a-different-port

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!