可能是一个简单调整的问题,但我不知道哪里出错了。
我希望主机成为我的rails应用程序的服务器,它使用Capistrano 3.2.1进行部署。 这是运行Apache / 2.2.15的Unix机器,名为eng-perf(企业内部机器,目前没有www.address.com语法)。
我跟着this guide,整个安装过程没有遇到任何麻烦。 我编辑了配置文件,看起来像这样:
<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>
这给了我这个错误:
未找到
在此服务器上找不到请求的网址。
接下来,我尝试按照指南创建虚拟应用程序 - as explained here,并将配置文件更改为:
<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>
这导致完全相同的Not Found错误。所以,我想我错过了很简单的事情......
另外,我尝试重启apache服务器并提示:httpd: Could not reliably determine the server's fully qualified domain name, using the.machine.ip.addr for ServerName
结果我将ServerName
字段更改为此地址 - 但这也不起作用。
更新
根据Rich的建议,我更新了配置文件,现在我得到了这个输出:
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>'
答案 0 :(得分:0)
我们使用以下内容:
#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>
我怀疑问题在于你没有正确地调用你的域名。它会对请求中的内容感到困惑