ruby-on-rails – localhost中的rails子域
发布时间:2020-12-16 20:49:32 所属栏目:百科 来源:网络整理
导读:在启动服务器运行之前,应该配置应用程序主机以便运行应用程序,因为此应用程序支持多个用户的子域,转到etc / hosts文件并添加子域,如下所示: sudo nano /etc/hosts add the text below at the end of you hosts file :127.0.0.1 admin.daycare.no127.0.0.1 d
在启动服务器运行之前,应该配置应用程序主机以便运行应用程序,因为此应用程序支持多个用户的子域,转到etc / hosts文件并添加子域,如下所示:
sudo nano /etc/hosts & add the text below at the end of you hosts file : 127.0.0.1 admin.daycare.no 127.0.0.1 daycare.no 127.0.0.1 worker.daycare.no 127.0.0.1 manager.daycare.no 127.0.0.1 parent.daycare.no 这是要求,我这样做,但现在仍然如此 http://daycare.no:3000 没跑,给我一个错误 **The following error was encountered while trying to retrieve the URL: http://daycare.no:3000/ Unable to determine IP address from host name daycare.no The DNS server returned: Name Error: The domain name does not exist. This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.** 解决方法
保存/ etc / hosts文件后,像这样运行rails应用程序
rails s -p 3000 -b daycare.no 在浏览器中 http://daycare.no:3000 就个人而言,我使用lvh.me:3000只运行rails s -p 3000 -b lvh.me无需触摸/ etc / hosts文件. 默认情况下,您无法在没有Internet连接的情况下浏览链接lvh.me:3000,解决方法是将127.0.0.1 lvh.me添加到主机文件中. # /etc/hosts file 127.0.0.1 localhost 127.0.0.1 lvh.me #make sure lvh.me is after localhost otherwise will not work 但是,每次重启服务器时运行它都很烦人. 设置自定义命令: sudo nano .bash_profile # OR sudo nano .bashrc # OR sudo nano .profile 并将这些行添加到那里: alias lvh='rails s -p 3000 -b lvh.me' alias lvh_production='RAILS_ENV=production rails s -p 3000 -b lvh.me' #production 不要忘记重新启动终端选项卡,关闭并打开新选项卡或在同一选项卡上运行此命令. ?/ .bash_profile取决于你在顶部使用的内容. 替代解决方案是POW(LINK)服务器可以给你自定义域smth像daycare.dev. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- PMD-ATPCO-RuleSet_V7.xml 4
- Ajax/jQuery – 在网页加载时将网页内容加载到div中?
- Swift-->ViewController跳转,转场以及自定义动画
- flash as3 TypeError: Error #1006: value 不是函数。
- 详解VB中连接access数据库的几种方法
- c – 在boost hana中过滤元组
- xml中qualified的作用
- oracle express 安装和 navicat premium 安装。
- ruby-on-rails – RSpec:未初始化的常量ActiveRecord(Name
- c# – 数据访问层 – 设计类应该负责创建保存