Re: euphoria-mvc - app:run()

new topic     » goto parent     » topic index » view thread      » older message » newer message
jmduro said...

Oops, I removed the templates directory when I made some cleaning on my document root folder!

After recreating the templates folder and the index.html file, everything is OK now!

So finally, here are some recommendations:

  • verify Apache modules alias, actions and rewrite are loaded: sudo a2query -m | sort
  • if not enable them: sudo a2enmod actions; sudo a2enmod alias; sudo a2enmod rewrite
  • put Add CGI Handler instructions in a file named /etc/apache2/conf-available/eui4.1.conf
  • enable the configuration: sudo a2enconf eui4.1
  • reload Apache configuration: sudo systemctl reload apache2

Unfortunately, given the Swiss-army-tool nature of Apache, it's hard to debug each particular configuration. This is especially true if it's been modified in some way from the defaults (i.e. you've installing phpMyAdmin or already running another website). Even the default configurations provided between distros and their releases can be different, which is especially frustrating (e.g. Debian uses apache2.conf but RHEL uses httpd.conf). It's for these reason that I'm trying to limit asking the user to configure anything directly in apache2.conf (or /etc/apache2/conf.d) unless absolutely necessary. I'm looking for sane defaults here. I would recommend undoing these changes and limit yourself to only enabling the required modules and adding configurations via .htaccess instead.

jmduro said...

Running index.esp directly shows the same error:

$ eui index.esp 
Status: 404 Not Found 
Content-Length: 208 
 
<!DOCTYPE html> 
<html> 
<head> 
  <title>404 Not Found</title> 
</head> 
<body> 
  <h1>404 Not Found</h1> 
  <p>The requested URL was not found on this server.</p> 
  <hr> 
  <p><em>Apache</em></p> 
  </body> 
</html> 

The route parser expects certain environment variables to come from the web server when making CGI calls, at the very least it needs PATH_INFO (the requested path) and REQUEST_METHOD (like GET or POST). If your index.esp is correctly marked as executable, you should be able to test the CGI mode like this:

$ PATH_INFO=/ REQUEST_METHOD=GET ./index.esp 

And you should get a proper response with Content-Type and Content-Length followed by the output from your index() route handler.

Make sure you're not missing the Options +ExecCGI directive and that mod_cgi and mod_mime are enabled (these are required for AddHandler to work correctly).

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu