404用的Apache2和客运部署Rails应用程序未找到错误 [英] 404 Not found error in deploying a Rails app with Apache2 and Passenger
问题描述
大概简单的调整的问题,但我不知道怎么回事错了。
我要一台主机是我的Rails应用程序,其使用Capistrano的部署3.2.1服务器。
这是一台Unix机器运行Apache / 2.2.15,名为ENG-PERF(企业内部机器,所以没有www.address.com语法此刻)。
我也跟着<一个href=\"https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#_deploying_a_ruby_on_rails_1_x_or_2_x_but_not_rails_gt_3_x_application\"相对=nofollow>本指南和整个安装过程了没有任何麻烦。
我编辑的配置文件,以便它看起来像这样:
&LT;虚拟主机*:80&GT;
服务器名CHI-PERF
#!一定要指出的DocumentRoot公!
的DocumentRoot的/ var / WWW / eng_performance /电流/公/
&LT;目录/ var / WWW / CHI-性能/电流/公/&GT;
#这阿帕奇放松安全设置。
所有的AllowOverride
#多视图必须关闭。
选项-MultiViews
#取消这个,如果你是在Apache&GT; = 2.4:
#Require授予所有
&LT; /目录&GT;
&LT; /虚拟主机&GT;
这给了我这个错误:
未找到
请求的URL /没有被此服务器上找到。
接下来,我试图通过创建假人应用程序 - <后续的指导href=\"https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#_tutorial_example_writing_and_deploying_a_hello_world_rack_application\"相对=nofollow>这里解释,并改变了配置文件是:
&LT;虚拟主机*:80&GT;
服务器名CHI-PERF
#!一定要指出的DocumentRoot公!
的DocumentRoot的/ var / WWW / rack_example /公/
&LT;目录/ var / WWW / rack_exmaple /公/&GT;
#这阿帕奇放松安全设置。
所有的AllowOverride
#多视图必须关闭。
选项-MultiViews
#取消这个,如果你是在Apache&GT; = 2.4:
#Require授予所有
&LT; /目录&GT;
&LT; /虚拟主机&GT;
这导致完全一样Not Found错误。所以,我想我失去了一些东西很简单..
另外,我试图重新启动Apache服务器,并提示:的httpd:无法可靠地确定了服务器的完全合格的域名,使用the.machine.ip.addr对于ServerName
因此,我改变了服务器名称
字段是这个寻址,但没有任何工作。
更新:
以下富的提醒,我更新了配置文件,所以现在我得到这样的输出:
config.ru:2:语法错误,意想不到的tIDENTIFIER,期待= GT;
... [200,{Content-Type的= GT;text / html的},[你好&LT; B&GT;与世界LT; / B ...
... ^
config.ru:2:语法错误,意想不到的tSTRING_BEG,期待keyword_do或'{'或'('
... {的Content-Type =&gt;中的text / html},[你好&LT; B&GT;与世界LT; / B&gt;中]
... ^
config.ru:2:语法错误,意想不到的tIDENTIFIER,keyword_end期待
...-类型=&GT; text / html的},[你好&LT; B&GT;与世界LT; / B&gt;中]
... ^
config.ru:2:未结束的正则表达式符合文件结束
config.ru:2:语法错误,意想不到的输入结束,预计keyword_end
)}。to_app
^(的SyntaxError)
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-$p$ploader.rb:112:in `EVAL
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-$p$ploader.rb:112:in `preload_app
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-$p$ploader.rb:158:in `&LT;模块:应用&GT;'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-$p$ploader.rb:29:in`&LT;模块:PhusionPassenger&GT;'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-$p$ploader.rb:28:in`&lt;主&GT;'
我们使用以下命令:
#等/的Apache2 / apache2.conf
&LT;虚拟主机*:80&GT;
服务器名eng-perf.com 的DocumentRoot的/ var / WWW / rack_example / plublic
&LT;目录/ var / WWW / rack_example /公共&GT;
所有允许
选项-MultiViews
&LT; /目录&GT; ScriptAlias指令/的cgi-bin / / usr / lib目录/ cgi-bin目录
&LT;目录/ usr / lib目录/ cgi-bin目录&GT;
设置AllowOverride无
选项+ ExecCGI -MultiViews + SymLinksIfOwnerMatch
为了允许,拒绝
所有允许
&LT; /目录&GT;
&LT; /虚拟主机&GT;
我怀疑问题在于你没有正确调用你的域名。它会弄不清楚什么它寻找关于请求
probably a matter of simple adjustment but I have no idea whats going wrong.
I want a host to be a server for my rails application, which was deployed using Capistrano 3.2.1. This is a Unix machine running Apache/2.2.15, named eng-perf (corporate internal machine, so no www.address.com syntax at the moment).
I followed this guide and the entire installation process went without any trouble. I edited the configuration file so that it looks like this:
<VirtualHost *:80>
ServerName eng-perf
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/eng_performance/current/public/
<Directory /var/www/eng-performance/current/public/>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
That gave me this error:
Not Found
The requested URL / was not found on this server.
Next, I tried following the guide by creating the dummies application- as explained here, and changed the configuration file to be:
<VirtualHost *:80>
ServerName eng-perf
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/rack_example/public/
<Directory /var/www/rack_exmaple/public/>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
That resulted the exact same Not Found error. So, I guess I'm missing something quite simple..
Also, I tried to restart the apache server and prompted: httpd: Could not reliably determine the server's fully qualified domain name, using the.machine.ip.addr for ServerName
As a result I changed the ServerName
field to be this address- but that didn't work either.
Update:
Following Rich's advise, I updated the configuration file so now I get this output:
config.ru:2: syntax error, unexpected tIDENTIFIER, expecting =>
... [200, { "Content-Type => "text/html" }, ["hello <b>world</b...
... ^
config.ru:2: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
... { "Content-Type => "text/html" }, ["hello <b>world</b>"]]
... ^
config.ru:2: syntax error, unexpected tIDENTIFIER, expecting keyword_end
...-Type => "text/html" }, ["hello <b>world</b>"]]
... ^
config.ru:2: unterminated regexp meets end of file
config.ru:2: syntax error, unexpected end-of-input, expecting keyword_end
)}.to_app
^ (SyntaxError)
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-preloader.rb:112:in `eval'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-preloader.rb:112:in `preload_app'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/home/deploy/.rvm/gems/ruby-2.0.0-p481/gems/passenger-4.0.50/helper-scripts/rack-preloader.rb:28:in `<main>'
We use the following:
#etc/apache2/apache2.conf
<VirtualHost *:80>
ServerName eng-perf.com
DocumentRoot /var/www/rack_example/plublic
<Directory /var/www/rack_example/public>
Allow from all
Options -MultiViews
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I suspect the problem lies with your not calling your domain correctly. It's going to get confused about what it's looking for on the request
这篇关于404用的Apache2和客运部署Rails应用程序未找到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!