DeWitt
DeWitt

Reputation: 23

Rails server - Port problems

I'm trying to launch a rails server on the shared hosting I just bought, but I've got some little problems.

1- I can't launch rails server on port 90. I get an error.

/opt/alt/ruby21/lib64/ruby/2.1.0/socket.rb:206:in bind': Permission denied - bind(2) for 67.205.125.31:90 (Errno::EACCES) from /opt/alt/ruby21/lib64/ruby/2.1.0/socket.rb:206:inlisten' from /opt/alt/ruby21/lib64/ruby/2.1.0/socket.rb:461:in block in tcp_server_sockets' from /opt/alt/ruby21/lib64/ruby/2.1.0/socket.rb:232:ineach' from /opt/alt/ruby21/lib64/ruby/2.1.0/socket.rb:232:in foreach' from /opt/alt/ruby21/lib64/ruby/2.1.0/socket.rb:459:intcp_server_sockets' from /opt/alt/ruby21/lib64/ruby/2.1.0/webrick/utils.rb:75:in create_listeners' from /opt/alt/ruby21/lib64/ruby/2.1.0/webrick/server.rb:132:inlisten' from /opt/alt/ruby21/lib64/ruby/2.1.0/webrick/server.rb:113:in initialize' from /opt/alt/ruby21/lib64/ruby/2.1.0/webrick/httpserver.rb:45:ininitialize' from /home/tmtcmon/rubyvenv/App/2.1/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:in new' from /home/tmtcmon/rubyvenv/App/2.1/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:inrun' from /home/tmtcmon/rubyvenv/App/2.1/gems/rack-1.6.4/lib/rack/server.rb:286:in start' from /home/tmtcmon/rubyvenv/App/2.1/gems/railties-4.2.6/lib/rails/commands/server.rb:80:instart' from /home/tmtcmon/rubyvenv/App/2.1/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in block in server' from /home/tmtcmon/rubyvenv/App/2.1/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:intap' from /home/tmtcmon/rubyvenv/App/2.1/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in server' from /home/tmtcmon/rubyvenv/App/2.1/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:inrun_command!' from /home/tmtcmon/rubyvenv/App/2.1/gems/railties-4.2.6/lib/rails/commands.rb:17:in <top (required)>' from bin/rails:4:inrequire' from bin/rails:4:in `'

Could this error be cause by the fact I'm on a shared hosting, therefore I couldn't launch something on port 90 because it is already used ?

2- I can't launch rails server on port 3000. (the default port). This time I can launch my server, but can't acces it with http//:domain-name.com:3000

3- If I launch rails server on a random port, (I tried 30,000) the server works perfectly. The problem is http://domain-name.com:30000 doesn't look real good and I'd prefer only http//:domain-name.com

So, with those three problems, three questions :

1- Is it possible to launch my server on port 90 even if I have shared hosting ? If so, do you have an idea what did I did wrong ?

2- Why can't I launch effectivly on port 3000 ? (this one isn't really a problem because I'd prefer the server to launch on port 90, but I'm curious.

3- Is it a way to redirect all my traffic on port 30,000 without http//:domain-name:30000 being showed in the adress bar ? I've managed to do that with .htacces, the user can connect by typing http//:domain-name but it shows http://domain-name:30000 in the adress bar...

Thanks in advance !

EDIT : Sorry if the question as already been answered, but if so, I couldn't find it after hours of research...

Upvotes: 1

Views: 788

Answers (1)

Hang
Hang

Reputation: 395

You cannot bind to port 90 or anything less than 1024 if you are not root, and probably someone else is running a service on port 3000 already, you can do a netstat -nat | grep 3000 to see if there is any process is listening.

Upvotes: 2

Related Questions