I'm making 2 blogs with rails. Rails server for blog2 is set to localhost:3000 and is working fine. The problem is, I tried to work on blog1 (it's server is also set to localhost:3000), and 'rails s' or 'rails server' command is not working. I guess it's because servers for both blogs is set to single one. How could I change the default server?
Asked
Active
Viewed 624 times
1
-
2possible duplicate of [How to change Rails 3 server default port in develoment?](http://stackoverflow.com/questions/3842818/how-to-change-rails-3-server-default-port-in-develoment) – max Jul 22 '15 at 01:38
-
are you starting both servers from same directory? because that would be an issue – sethi Jul 22 '15 at 04:11
2 Answers
2
You need to set it to use a different port. eg. rails s -p 4000
for localhost:4000

Benjamin
- 1,060
- 11
- 16
-
I tried 'rails s -p 4000', but the server is still not working. (still shutting down by itself) – Sunghyuk Park Jul 22 '15 at 03:34
0
So you will need to change to a different port like the comment the user above has suggested. Follow that link if you'd like to do that.
An alternative is to delete the process once you are done working with either one of your blogs, so in the terminal type:
lsof -wni tcp:3000
From here you will be able to see a 'processid', figure out which one you don't want anymore then type in the terminal:
kill -9 [processid]
In this way you only work with one blog at a time.

ifma
- 3,673
- 4
- 26
- 38