Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Created June 21, 2009 06:18
Show Gist options
  • Save masakielastic/133424 to your computer and use it in GitHub Desktop.
Save masakielastic/133424 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
require 'rack'
class HelloRack
def call(env)
[200, {'Content-Type' => 'text/html; charset=UTF-8'}, ['こんにちは、Rack']]
end
end
Rack::Handler::CGI.run HelloRack.new
# -*- coding: utf-8 -*-
def application(environ, start_response):
status = '200 OK'
output = 'こんにちは、Python'
response_headers = [('Content-type', 'text/html; charset=UTF-8')]
start_response(status, response_headers)
return [output]

sudo 2enmod userdir

sudo gedit /etc/apache2/mods-available/userdir.conf and add a AliasMatch directive.

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root
        AliasMatch ^/([^/]+)(.*) /home/$1/public_html/$2

<Directory /home/*/public_html>
    DirectoryIndex index.html index.htm index.php index.rb index.wsgi index.cgi

sudo /etc/init.d/apache2 restart

cgi Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec +ExecCGI AddHandler cgi-script .cgi .pl .rb

wsgi AddHandler wsgi-script .wsgi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment