Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.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

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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.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 Apache无法获取新的索引页-RubyonRails-EC2_Ruby On Rails_Apache_Amazon Ec2_Passenger - Fatal编程技术网

Ruby on rails Apache无法获取新的索引页-RubyonRails-EC2

Ruby on rails Apache无法获取新的索引页-RubyonRails-EC2,ruby-on-rails,apache,amazon-ec2,passenger,Ruby On Rails,Apache,Amazon Ec2,Passenger,我在RoR服务器上创建了一个新项目,我想重定向apache以从我的app/views/home/index.html.erb获取新的索引文件,但它似乎不起作用 这是我创建新索引文件之前的虚拟服务器conf文件 <VirtualHost *:80> ServerName www.example.com ServerAlias example.com DocumentRoot /var/www/html/blog/public ErrorLog logs/

我在RoR服务器上创建了一个新项目,我想重定向apache以从我的app/views/home/index.html.erb获取新的索引文件,但它似乎不起作用

这是我创建新索引文件之前的虚拟服务器conf文件

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot /var/www/html/blog/public
    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common
<Directory /var/www/html/blog/public>
        Allow from all
    PassengerEnabled off 
    Options +Indexes +FollowSymLinks -MultiViews
</Directory>
</VirtualHost>

服务器名www.example.com
ServerAlias example.com
DocumentRoot/var/www/html/blog/public
错误日志/example.com-error\u日志
CustomLog logs/example.com-access\u log common
通融
乘客逃走了
选项+索引+FollowSymLinks-多视图
在我删除public/index.html之后

<VirtualHost *:80>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot /var/www/html/blog/app/views/home/
    ErrorLog logs/example.com-error_log
    CustomLog logs/example.com-access_log common
<Directory /var/www/html/blog/app/views/home/>
        Allow from all
    PassengerEnabled off 
    Options +Indexes +FollowSymLinks -MultiViews
</Directory>
</VirtualHost>

服务器名www.example.com
ServerAlias example.com
DocumentRoot/var/www/html/blog/app/views/home/
错误日志/example.com-error\u日志
CustomLog logs/example.com-access\u log common
通融
乘客逃走了
选项+索引+FollowSymLinks-多视图
完全编辑的最后一个答案 请发布路由文件,但将DocumentRoot行改回

DocumentRoot/var/www/html/blog/public

你指向你的公共目录,你的路由会告诉应用程序显示app/home/index,而不是apache(如果你使用的是rails,那么它应该被使用)

在config/routes.rb中,确保您有一行
root:to=>“home#index”

更新1
检查显示选项的行是否有正确的参数,更重要的是,您需要它。就我个人而言,我使用nginx和unicorn,但我不记得我和乘客乱搞时的那条线路。

我把它修好了。我必须在httpd.conf中指定RailsEnv,然后触摸tmp/restart.txt

在我这样做之前,我得到了正确的输出,然后它只给我apache页面。我也做了touch命令,但仍然没有什么我有root:to=>'home#index'我的apache被恢复到DocumentRoot/var/www/html/blog/public我在我的应用程序的tmp文件夹中做了一次apache重启和touch restart.txt,但仍然没有在本地机器上进行uplet的回溯开发,您可以在执行
rails服务器之后,通过访问localhost:3000访问它,对吗?请确认。哦,把这行也改一下。我在亚马逊ec2服务器上,我不在本地工作。我确实更改了目录和文档根目录,我还试图杀死passenger,因为touch restart.txt报告了一些错误。所以我不知道还能做什么