我的Rails应用程序为每个客户使用一个子域。Rails3 - 在开发中使用lvh.me,在生产中做什么?
所以我有:
customer1.domain.com/ customer2.domain.com/ customer3.domain.com/
通常情况下,一个人必须要添加在每个客户进入/等/主机。然而,我使用了http://railscasts.com/episodes/221-subdomains-in-rails-3中描述的lvh.me。而在开发模式下,这种方式运行得很好。
现在我想部署。有没有办法避免向每个客户的etc/host添加条目?
我使用的是Nginx和Phusion Passenger。
当然,Nginx的路线可以使用通配符的所有接来电请求。我有server_name * .davinci.dev davinci.dev;但情况是,我必须添加到/ etc/hosts这个:127.0.0.1 davinci.local,以便我的电脑知道,当我进入这台主机 - > davinci.local我的意思是我自己的电脑 - > 127.0.0.1。通过这个设置,我可以在我的开发机器上访问我的网站的根域。问题是文件/ etc/hosts不接受通配符。我不能说* .davinci.local,所以当我在我的网络浏览器上输入customer1.davinci.local时,我的电脑将无法识别为localhost。 – Nerian 2010-12-18 02:55:35
并且为每个客户端添加一个条目到localhost,这是非常不方便的,因为可能有数百个。 – Nerian 2010-12-18 02:57:15