change localhost port number in a rails application

5.9k Views Asked by At

I just started learning RoR as a backend technology for React. I came across a tutorial that uses 'react-rails' and it chooses the localhost port number to be 3000 for my development environment by default.

Is there any way to change this default port number?

2

There are 2 best solutions below

0
Rohan On BEST ANSWER

The below mentioned link will help you regarding the port and address while running rails server

Change my default localhost port in Rails 5.

0
Anand On

In development environment(local machine) you can not use port number below 1024

To start rails server on different port: -

rails s -p 5000 #or you can set your own port (> 1024)

Or to start is on port 80 or less than 1024:-

rvmsudo rails server -p 80