Rails development server on port 80
Sometimes you just have to run the rails development server on port 80 for whatever reason. Could be a callback that can only be posted to port 80. Or it is something else.
This is how it is done, at first you need to configure your $hell of choice. In my case the below code goes into my ~/.zshrc
but in your case it could be ~/.bash_profile
.
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/sbin:$PATH
export PATH="$HOME/.rbenv/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
function rbenvsudo(){
executable=$1
shift 1
sudo $(rbenv which $executable) $*
}
Reload your shell with source ~/.zshrc
and now you can run commands as sudo with.
rbenvsudo bundle exec rails s -p 80 Puma
Written by Mikael Henriksson
Related protips
2 Responses
Mmmh, it doesn't work
⭑ shideneyu ~/project/jugop(master) ✗»rbenvsudo bundle exec rails s -p 80 [16:48:07]
[sudo] password for shideneyu:
bundler: command not found: rails
Install missing gem executables with bundle install
⭑ shideneyu ~/project/jugop(master) ✗»rbenvsudo bundle [16:48:11]
Using rake (10.0.3)
Using multijson (1.2.0)
Using activesupport (3.1.10)
Using builder (3.0.4)
Using i18n (0.6.1)
Using activemodel (3.1.10)
Using erubis (2.7.0)
Using rack (1.3.9)
Using rack-cache (1.2)
Using rack-mount (0.8.3)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.0.4)
Using actionpack (3.1.10)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.3.3)
Using actionmailer (3.1.10)
Using arel (2.2.3)
Using tzinfo (0.3.35)
Using activerecord (3.1.10)
Using activeresource (3.1.10)
Using addressable (2.2.8)
Using ansi (1.4.1)
Using bcrypt-ruby (3.0.1)
Using browser (0.1.5)
Using coffee-script-source (1.2.0)
Using execjs (1.2.13)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.6)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.1.10)
Using coffee-rails (3.1.1)
Using commonjs (0.2.6)
Using daemons (1.1.8)
Using ormadapter (0.0.7)
Using warden (1.1.1)
Using devise (2.0.4)
Using eventmachine (0.12.10)
Using excon (0.15.4)
Using multipart-post (1.1.5)
Using faraday (0.8.4)
Using fattr (2.2.1)
Using hashie (1.2.0)
Using heroku-api (0.2.13)
Using launchy (2.1.0)
Using netrc (0.7.5)
Using rest-client (1.6.7)
Using rubyzip (0.9.9)
Using heroku (2.29.0)
Using highline (1.6.19)
Using httpauth (0.2.0)
Using jquery-rails (1.0.19)
Using jwt (0.1.5)
Using less (2.2.2)
Using less-rails (2.2.3)
Using libv8 (3.3.10.4)
Using miniportile (0.5.1)
Using newrelicrpm (3.5.7.59)
Using nokogiri (1.6.0)
Using oauth2 (0.8.0)
Using omniauth (1.1.1)
Using omniauth-oauth2 (1.1.1)
Using omniauth-facebook (1.4.1)
Using options (2.3.0)
Using pg (0.14.0)
Using prgeohash (1.0.0)
Using progressbar (1.0.0)
Using bundler (1.5.3)
Using rails (3.1.10)
Using railsservestaticassets (0.0.1)
Using railsstdoutlogging (0.0.3)
Using rails12factor (0.0.2)
Using rsolr (1.0.9)
Using sass (3.1.12)
Using sass-rails (3.1.5)
Using sqlite3 (1.3.5)
Using sunspot (2.0.0)
Using sunspotrails (2.0.0)
Using sunspotsolr (2.0.0)
Using therubyracer (0.10.2)
Using thin (1.4.1)
Using tinymce-rails (3.5.8)
Using turn (0.8.2)
Using twitter-bootstrap-rails (2.1.0)
Using uglifier (1.2.2)
Using willpaginate (3.0.3)
Using willpaginate-bootstrap (0.2.1)
Your bundle is complete!
Use bundle show [gemname]
to see where a bundled gem is installed.
⭑ shideneyu ~/project/jugop(master) ✗»rbenvsudo bundle exec rails s -p 80 [16:48:18]
bundler: command not found: rails
Install missing gem executables with bundle install
Sorry for the wrong indentation.
Anyways, installing rails with the new command solved the issue, thanks for the tutorial !