Running Sinatra on port 80

后端 未结 4 1209
旧时难觅i
旧时难觅i 2021-02-18 23:33

I installed Sinatra and it works but it uses port 4567 by default. I want it to run on port 80.

In an effort to get it to work on port 80, I tried this:

         


        
相关标签:
4条回答
  • 2021-02-19 00:00

    Can't you just use (http://www.sinatrarb.com/configuration.html):

    set :port, 80
    

    Note that in order to bind a socket to port 80, you'll need to have superuser privileges.


    And, by the way,

    Using Sinatra.default_options to set base configuration items is obsolete

    From: http://www.sinatrarb.com/one-oh-faq

    0 讨论(0)
  • 2021-02-19 00:01

    An alternate way to accepted answer

    rvmsudo rackup -p 80
    

    In case one is using RVM to manage Ruby versions, you may not be able to use sudo that easily (or else would need to setup ruby in path).

    0 讨论(0)
  • 2021-02-19 00:14

    Any port below 1024 is for privileged processes only. You'd have to run as root to run the sinatra app directly on 80. You could reverse proxy - http://sinatra-book.gittr.com/#deployment.

    0 讨论(0)
  • 2021-02-19 00:26

    Yes, running anything other than Apache, Nginx, Varnish or HAProxy or port 80 is in my opiniona dangerous game. Those tools are very good at what they do. A reverse proxy setup is the way to go.

    0 讨论(0)
提交回复
热议问题