Is there any way I can use Apache as a ruby server ?
You may want to consider the 'Passenger' module, see the website. Yesterday I installed this module using their instructions on the website and it went well.
I did it via gem install passenger. I have not deployed anything as yet. Good luck with whatever option you choose.
Use eruby and libapache2-mod-ruby packages then activate the ruby module with sudo a2enmod ruby.
Don't forget to create a configuration file /etc/apache/conf.d/ruby.conf and put something in here, like :
AddType text/html .rhtml
AddType text/html .rbx
DirectoryIndex index.rhtml index.rbx
<IfModule mod_ruby.c>
RubyRequire apache/ruby-run
RubyRequire apache/eruby-run
<Files *.rbx>
Options +ExecCGI
setHandler ruby-object
rubyHandler Apache::RubyRun.instance
</Files>
<Files *.rhtml>
setHandler ruby-object
rubyHandler Apache::ERubyRun.instance
</Files>
</IfModule>
Related
I am trying to get to work the webplugin example in ete2 package in my own computer (Mac OS X Yosemite) (http://etetoolkit.org/docs/2.3/tutorial/tutorial_webplugin.html#module-ete2.webplugin)
I have reached to the point, where in apache2 error log I get the following errors:
[wsgi:error] [pid 1152] ['name'] The application with bundle ID (null) is running setugid(), which is not allowed.
[wsgi:error] [pid 1154] [client 127.0.0.1:51175] Truncated or oversized response headers received from daemon process 'webplugin_example': /Users/Liis/Sites/webplugin/wsgi/webplugin_example.py, referer: http://webplugin.com/
What I have done is:
1) I did everything said in http://jason.pureconcepts.net/2014/11/configure-apache-virtualhost-mac-os-x/
2) My /Sites folder consists of folder /webplugin
As a result, the webplugin.com shows the main page, but if I click on the 'Draw tree' button, the little box with question mark shows up and the mentioned error messages appear to the log file.
3) My /Hosts/.conf file looks like this:
LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/4.4.11/libexec/mod_wsgi.so
WSGIPythonHome "/Users/Liis/anaconda"
WSGIPythonPath "/Users/Liis/anaconda/lib/python2.7/site-packages"
<VirtualHost *:80>
DocumentRoot "/Users/Liis/Sites"
WSGIDaemonProcess webplugin_example user=_www group=_www processes=1 threads=25 header-buffer-size=32768 python-path="/Users/Liis/anaconda/lib/python2.7/site-packages"
WSGIProcessGroup webplugin_example
WSGIApplicationGroup %{GLOBAL}
ServerName "webplugin.com"
<Directory />
Require all granted
Options +FollowSymLinks
AllowOverride All
</Directory>
<Directory "/Users/Liis/Sites/webplugin/wsgi">
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
SetHandler wsgi-script
Order allow,deny
Allow from all
AddHandler wsgi-script .py
</Directory>
</VirtualHost>
Any help would be good:)
I have a feeling that the error could be somehow related to the X server thing, but I have no idea how to fix that in Mac.
All the best,
L.
I'm not only new to Laravel 4, but new to using frameworks. I thought I'd start with Laravel since it's gotten such good reviews.
I've got a good install of Laravel. I go to /l4/public and see the welcome page.
I'm trying to add a route to routes.php so that when I navigate to /l4/public/articles I get a response.
I get "The requested URL /l4/public/articles was not found on this server." Do I need to run an artisan command to compile the routes? It's probably something easy. Why this message?
routes.php
Route::get('/', function()
{
return View::make('hello');
});
Route::get('articles', function ()
{
//return View::make('articles');
return "Articles hello there";
});
Problem is solved by two editing changes in apache's httpd.conf file.
AllowOverride None is default. AllowOverride controls whether .htaccess files are processed.
mod_rewrite is commented out by default.
Changes to make:
Change 1: Activate mod_rewrite by uncommenting it.
Change 2:
Change
AllowOverride None
to
AllowOverride All
Now restart Apache...
The default .htaccess file that Laravel provides in the public folder specified some mod_rewrite rules. These rules were not getting applied because AllowOverride was set to none. Be sure and restart apache after changing these settings.
My configuration: Apache 2.4.6 on Windows XP.
It appears that there may be some security implications to the AllowOverride change. If anyone has additional information on this, I would like to hear it.
That Error basically say that the router cannot found your request. Make sure you already save your changes.
if you using the artisan command to running the page,just re-run again command "artisan Serve".
You need mod_rewrite on. Try: l4/public/index.php/articles
in httpd.conf change
<Directory />
AllowOverride none
Require all granted
</Directory>
to
<Directory />
AllowOverride all
Require all granted
</Directory>
then uncomment
#LoadModule rewrite_module modules/mod_rewrite.so
to
LoadModule rewrite_module modules/mod_rewrite.so
I have a ruby on rails application that is located at /home/user/application. I have a Apache webserver whose DocumentRoot is /var/www. And I have a symlink /var/www/application -> /home/user/application.
My apache configuration section that concerns the ruby on rails is the following:
RailsBaseURI /application
<Directory /home/user/application>
Order Allow,Deny
Allow from all
Options -MultiViews
</Directory>
I modified the Passenger code so in the very beginning of it spawning it would print (to a file) the option app_root. If it matters, I modified the file phusion_passenger/spawn_manager.rb in the method handle_spawn_application.
The value that I get is /home/user and this is wrong, I needed /home/user/application. So my question is, how does Passenger figures out the option['app_root'] (which becomes RAILS_ROOT|Rails.Root)?
Observation: I modified the Passenger code to hardcode app_root to /home/user/application and everything worked fine.
Change the symlink so that /var/www/application points to /home/user/application/public
Then just change RailsBaseURI to RackBaseURI and undo your changes to spawn_manager.rb
Previous discussion assumed single application.
<Directory /var/www/application/public>
Order Allow,Deny
Allow from all
Options -MultiViews
</Directory>
See the Apache Phusion documentation.
You need to add DocumentRoot and append /public to your Directory config and undo your changes to spawn_manager.rb.
As you noticed, the app_root is one directory up from what is specified.. The parent directory of /home/user/application/public is /home/user/application which is the Rails root.
You want RackBaseURI instead of RailsBaseURI for Rails > 3
The reasoning behind this is so that Apache serves the static assets (which are in the public directory) and then if that isn't present Passenger routes the request to the Rails app.
I'm dealing with a Magento site that has a 3rd party CMS integration. When I enable Mod_deflate via the .htaccess file most of the site works well. All of the pages that pull the information from the CMS show "gobbledy-gook" and it apprears that what is supposed to apprear is not getting decompressed.
I'm attempting to simply exclude parts of the site that employ the CMS from compression (including the home page), however, I'm not sure if I can exclude urls from mod_deflate via SetEnvIfNoCase. A yea, nea or syntax help would be appreciated.
Here are my lines:
SetEnvIfNoCase Request_URI "(/site/*)" no-gzip dont-vary #exclude www.example.com/site/
SetEnvIfNoCase Request_URI "(/)" no-gzip dont-vary #only exclude homepage or index.php
So here is the solution. If you need to gzip your site, but for some reason parts of your site don't react well to gzip compression - such as the 3rd party CMS integration with Magento. Enable mod-Deflate in your .htaccess file and include this line:
SetEnvIf Request_URI ^/yourdir(.*) no-gzip dont-vary
yourdir being the directory where your cms is installed.
From my reading of the Apache docs you would want
SetEnvIf
not
SetEnvIfNoCase
AllInOne, would the correct syntax be?:
SetEnvIf Request_URI "(/site/*)" no-gzip dont-vary
SetEnvIf Request_URI "(/)" no-gzip dont-vary
I have Windows XP/Django/apache/mod_python working on localhost. All parts are working with the exception of the admin CSS not rendering. The admin works, but no html formatting. I've made additions in:
settings.py
INSTALLED_APPS
'django.contrib.admin',
urls.py
from django.contrib import admin
admin.autodiscover()
(r'^admin/(.*)', admin.site.root),
conf/http.conf
<Location "/">
SetHandler python-program
PythonPath "['C:/django'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonDebug On
</Location>
<Location "/cpssite/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myapplication.settings
PythonInterpreter /myapplication
PythonDebug On
</Location>
I'm stumped. Is there more code I should have added somewhere?
Does your ADMIN_MEDIA_PREFIX exist? Is it different from MEDIA_URL? Did you include the trailing slash? Is Apache handled to correctly serve up the admin media?
The default Django configuration has the admin media located at {Django install dir}/contrib/admin/media. ADMIN_MEDIA_PREFIX defaults to /media/. So you need to add something like this to your Apache config:
Alias /media/ /path/to/django/contrib/admin/media/
This will tell Apache that requests for mysite.com/media/css/whatever.css mean to serve up /path/to/django/contrib/admin/media/css/whatever.css, which should solve your issue.
I used to have the same problem and the following entry in the http.conf worked fine with me:
<Directory "Path-to-python/Lib/site-packages/django/contrib/admin/media/">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
Alias /media/ "Path-to-Python/Lib/site-packages/django/contrib/admin/media/"
<Location "/mysite/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
PythonOption django.root /mysite
PythonInterpreter mysite
PythonDebug On
PythonPath "['C:/Python/Django/apps'] + sys.path"
</Location>
Here is my django-specific apache configuration. Note, django handles every incoming url to the site (location /) except media, where it's disabled, and the data is served from django's media directory.
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE mysite.settings
#PythonOption django.root /
PythonDebug On
PythonPath "['e:/dj'] + sys.path"
</Location>
Alias /media e:/dj/django-trunk/django/contrib/admin/media/
<Location "/media">
SetHandler None
</Location>
If you don't want to have admin media use the /media directory, you can specify ADMIN_MEDIA_PREFIX = 'admin_media', then create a link/alias from your webserver which redirects calls to /admin_media/ to the /usr/share/pyshared/django/contrib/admin/media (depending on your OS) for your production server...
Since the question is from long time back, this may not be a relevant answer but I am putting this information to help anyone who happens to stumble here just like me.
As of version 1.4, ADMIN_MEDIA_PREFIX setting has been deprecated. The ways of serving static and media files with version >= 1.4 are described here
https://docs.djangoproject.com/en/dev/releases/1.4/#django-contrib-admin
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#serving-files
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/#serving-the-admin-files
Basically it can be setup in 4 steps -
Set STATIC_ROOT to point to directory which will serve all the static files of your site
Set STATIC_URL for which static content should be served
Run manage.py collectstatic
Configure your webserver to serve requests for STATIC_URL from STATIC_ROOT
Same for media files