简体   繁体   中英

404 Not found error in deploying a Rails app with Apache2 and Passenger

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM