
--
以上

apt-get install php-pear
pear channel-discover pear.symfony-project.com pear channel-discover pear.indeyets.pp.ru pear install indeyets/AppServer
<?php
class HelloWorldApp{
public function __invoke($env) {
return array(200, array('Content-type', 'text/plain'), 'Hello world');
}
}bodyの戻り値がただの文字列なのが、AppServerの、ちょっと変わってるところ。apps:
-
app: &HelloWorldApp
class: HelloWorldApp
file: ./HelloWorldApp.class.php
middlewares: []
servers:
-
protocol: HTTP
socket: 'tcp://0.0.0.0:8090'
min-children: 5
max-children: 10
app: *HelloWorldAppaip app aip.yaml
apt-get install libapache2-mod-passenger
mkdir /usr/local/www/rack-scripts/ mkdir /usr/local/www/rack-scripts/public mkdir /usr/local/www/rack-scripts/tmp
class HelloWorldApp
def call(env)
[ 200, { 'Content-Type' => 'text/plain' }, ['Hello world'] ]
end
end
require 'application.rb' run HelloWorldApp.new
<Virtualhost *:80>
DocumentRoot /usr/local/www/rack-scripts/public
RackBaseURI /
<Directory /usr/local/www/rack-script>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
(DocumentRootはpublicディレクトリを指定するところが特徴かも)/etc/init.d/apache2 restart
apt-get install librack-ruby1.9.1 ※ ruby1.8ならlibrack-ruby1.8
class HelloWorldApp
def call(env)
[ 200, { 'Content-Type' => 'text/plain' }, ['Hello world'] ]
end
end
require 'application.rb' run HelloWorldApp.new
rackup1.9.1 -I . ※ ruby1.8ならrackup1.8
rackup1.9.1 -I . -p 8080
rackup1.9.1 --help
apt-get install libplack-perl
sub {
my $env = shift;
return [ '200', [ 'Content-Type' => 'text/plain' ], [ "Hello world" ] ];
};plackup application.psgi
apt-get install openjdk-6-jdk
export PATH=$PATH:/root/js/narwhal/bin
tusk install jack
exports.app = function(env) {
return { status : 200, headers : {"Content-Type":"text/plain", "Content-Length":"11"}, body : ["Hello worLd"] };
}※手元の環境ではContent-Lengthが無いとエラーだったので、つけてみました。jackup
apt-get install libapache2-mod-wsgi
def application(env, start_response):
start_response('200 OK', [('Content-type', 'text/plain')])
return ['Hello world']
<Virtualhost *:80>
WSGIScriptAlias / /usr/local/www/wsgi-scripts/application.wsgi
<Directory /usr/local/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
/etc/init.d/apache2 restart
def application(env, start_response):
start_response('200 OK', [('Content-type', 'text/html')])
return ['insecure query string echo', '<hr>', env['QUERY_STRING'], '<hr>']
from cgi import parse_qs, escape
def application(env, start_response):
q = parse_qs(env['QUERY_STRING'])
start_response('200 OK', [('Content-type', 'text/html')])
return ['hello', '<hr>',escape(q.get('test1', [''])[0]), '<hr>']
def application(env, start_response): start_response('200 OK', [('Content-type', 'text/plain')]) return ['Hello world']
class HelloWorldApp def call(env) [ 200, { 'Content-Type' => 'text/plain' }, ['Hello world'] ] end end
function(env) { return { status : 200, headers : {"Content-Type":"text/plain"}, body : ["Hello world"] }; }
sub {
my $env = shift;
return [ '200', [ 'Content-Type' => 'text/plain' ], [ "Hello World" ] ];
};
class HelloWorldApp{
public function call($env){
return array(200, array("Content-Type" => "text/plain"), array("Hello world"));
}
}