How to run rails s -p80 on 80 port?

后端 未结 5 1150
长情又很酷
长情又很酷 2020-12-07 07:36

By default,

 rails s #running on 3000 port

Now I want to run it on port 80. So I tried:

 sudo rails -s -p80
5条回答
  •  日久生厌
    2020-12-07 08:29

    Just forward the request from port 80 to 3000 using below command:

    sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000
    

    Another option is:

    rvmsudo rails server -p 80
    

    However please remember to free this port from Apache or other services which consume this port normally. Also, I m not sure giving sudo permission to RVM may have any security issue or not?

提交回复
热议问题