Run rails server in the domain that I displayed in the host file

I want to map:

www.example.com

in my host file, how can I start the "rails server" so it uses this domain?

+3
source share
2 answers

Edit the hosts file (instructions for Snow Leopard OSX)

  • sudo nano /etc/hosts
  • Add row 127.0.0.1 www.example.com
  • Update DNS settings with sudo dscacheutil -flushcache

Start the rails on the right port

rails serverwill now work on http://www.example.com//000/ . To get rid of: 3000, start Rails with: sudo rails server --port=80(or rvmsudoif you are using RVM)

For production use, you can see Kevin's answer.

+9
source

"" Nginx Apache . .

0

Source: https://habr.com/ru/post/1791068/


All Articles