Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails web应用程序在我的服务器和Apache上的位置_Ruby On Rails_Apache - Fatal编程技术网

Ruby on rails web应用程序在我的服务器和Apache上的位置

Ruby on rails web应用程序在我的服务器和Apache上的位置,ruby-on-rails,apache,Ruby On Rails,Apache,我在生产服务器上使用Apache和Rails应用程序时遇到了麻烦。我已经安装了所有的东西,图书馆,珠宝,所有的东西。问题是我的浏览器中出现了“禁止”错误。我甚至用“777”标记了我的应用程序目录,但仍然没有运气 因此,我的问题是: 您的ServerName指令是什么(在虚拟主机配置中) 应用程序在服务器上的位置 谁拥有你的应用程序目录 哪个用户应该拥有您的应用程序目录 假设您的Apache安装并启用了乘客(也称为mod_rails)模块,那么配置一个新的rails应用程序非常简单 <Vir

我在生产服务器上使用Apache和Rails应用程序时遇到了麻烦。我已经安装了所有的东西,图书馆,珠宝,所有的东西。问题是我的浏览器中出现了“禁止”错误。我甚至用“777”标记了我的应用程序目录,但仍然没有运气

因此,我的问题是:

  • 您的
    ServerName
    指令是什么(在虚拟主机配置中)
  • 应用程序在服务器上的位置
  • 谁拥有你的应用程序目录
  • 哪个用户应该拥有您的应用程序目录

  • 假设您的Apache安装并启用了乘客(也称为mod_rails)模块,那么配置一个新的rails应用程序非常简单

    <VirtualHost *:80>
    
      # Admin email, Server Name (domain name) and any aliases
      ServerAdmin webmaster@example.com
      ServerName  example.com
      ServerAlias www.example.com
    
      # Index file and Document Root (where the public files are located)
      # DirectoryIndex index.html
      DocumentRoot /path/to/app/public
    
      # Custom log file locations
      ErrorLog  /path/to/log/example.com/error.log
      CustomLog /path/to/log/example.com/access.log combined
    
    </VirtualHost>
    
    
    #管理员电子邮件、服务器名(域名)和任何别名
    服务器管理员webmaster@example.com
    ServerName example.com
    ServerAlias www.example.com
    #索引文件和文档根目录(公共文件所在的位置)
    #DirectoryIndex.html
    DocumentRoot/path/to/app/public
    #自定义日志文件位置
    ErrorLog/path/to/log/example.com/error.log
    CustomLog/path/to/log/example.com/access.log组合
    
    一些重要注意事项:

  • 默认环境是“生产”
  • 确保DocumentRoot指向应用程序的/public文件夹,而不是应用程序根目录

  • chmod 777
    可能不是正确答案。您需要确保
    Allow
    Deny
    指令正确应用于该位置。我很确定网上有很多简单而简短的howto,它们解释了如何运行一个简单的rails应用程序。你搜索过吗?谢谢Patrick,是的,我搜索过一个解决方案,过去我安装过几个服务器,这就是为什么这让我很困惑的原因。看起来我的每一个都是正确的,我想看看其他人是如何配置服务器的。