Prijedlozi #15845
Zatvorenapache modules
Dodano od Ernad Husremović prije više od 17 godina. Izmjenjeno prije skoro 16 godina.
20%
Opis
kako napraviti apache module
Fajlovi
| mod_methods-0.3.tar.gz (33,9 KB) mod_methods-0.3.tar.gz | Ernad Husremović, 18.11.2008 23:54 |
Povezani tiketi 1 (0 otvoreno — 1 zatvoren)
Izmjenjeno od Ernad Husremović prije više od 17 godina
Izmjenjeno od Ernad Husremović prije više od 17 godina
- Naslov promijenjeno iz apache toolbox u apache modules
Izmjenjeno od Ernad Husremović prije više od 17 godina
http://wiki.modruby.net/en/?FAQ
mod_ruby embeds the Ruby interpreter into the Apache web server, allowing Ruby CGI scripts to be executed natively. These scripts will start up much faster than without mod_ruby.
Izmjenjeno od Ernad Husremović prije više od 17 godina
mod_ruby podešenje¶
hernad@nmraka-1:~/devel/apache/mod-ruby-1.2.6$ ls /var/www/*ruby/*
/var/www/eruby/test.rhtml /var/www/ruby/test.rb
hernad@nmraka-1:~/devel/apache/mod-ruby-1.2.6$ cat /var/www/*ruby/*rhtml
#!/usr/bin/eruby
<html>
<head>
<title>Welcome to eruby Test</title>
</head>
<body>
<h2>eRuby test</h2>
<pre>
<%
3.times {
puts "selam alejkum dunja"
}
%>
</pre>
</body>
</html>
hernad@nmraka-1:~/devel/apache/mod-ruby-1.2.6$ cat /var/www/*ruby/test.rb
#!/usr/bin/ruby puts "selam alejkum dunja:"
hernad@nmraka-1:~/devel/apache/mod-ruby-1.2.6$ sudo invoke-rc.d apache2 reload
hernad@nmraka-1:~/devel/apache/mod-ruby-1.2.6$ cat /etc/apache2/sites-available/ruby
<IfModule mod_ruby.c>
# for Apache::RubyRun
RubyRequire apache/ruby-run
# da browser zna da je html output
AddType text/html .rhtml
#DocumentRoot "/home/hernad/devel/apache"
# exec files under /ruby as ruby scripts.
<Location /ruby>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options +ExecCGI
</Location>
# trebam za run eruby-ja
RubyRequire apache/eruby-run
# Handle files under /eruby as eRuby files
<Location /eruby>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Location>
# Handle *.rhtml files as eRuby files
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance
</Files>
</IfModule>
#sudi apt-get install ruby eruby
enableovo ruby
hernad@nmraka-1:~/devel/apache/mod-ruby-1.2.6$ sudo a2ensite ruby
hernad@nmraka-1:~/devel/apache/mod-ruby-1.2.6$ w3m 127.0.0.1/ruby/test.rb
=> ok
hernad@nmraka-1:~/devel/apache/mod-ruby-1.2.6$ w3m 127.0.0.1/eruby/test.rhtml
=> ok (html)
Izmjenjeno od Ernad Husremović prije više od 17 godina
- % završeno promijenjeno iz 0 u 20
Izmjenjeno od Ernad Husremović prije više od 17 godina
Izmjenjeno od Ernad Husremović prije više od 17 godina
mod_xsendfile:http://tn123.ath.cx/mod_xsendfile/ is a small Apache2 module that processes X-SENDFILE headers registered by the original output handler.
If it encounters the presence of such header it will discard all output and send the file specified by that header instead using Apache internals including all optimizations like caching-headers and sendfile or mmap if configured.
It is useful for processing script-output of e.g. php, perl or any cgi.
Izmjenjeno od Ernad Husremović prije više od 17 godina
XSendFile example
.htaccess
<Files out.php> XSendFile on </Files>
out.php
<?php
...
if ($user->isLoggedIn())
{
header("X-Sendfile: $somefile");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; file=\"$somefile\"");
exit;
}
?>
<h1>Permission denied</h1>
<p>Login first!</p>
Izmjenjeno od Ernad Husremović prije više od 17 godina
X-Sendfile¶
Send files faster with X-Sendfile
Rails' send_file has a beautiful, simple interface. Unfortunately, it ties up your Rails process with the rather mundane task of reading a file from disk. ....
There’s this slick HTTP header called “X-Sendfile” that Apache and Lighttpd support. It was made to address this kind of problem (isn’t that convenient?). Now, when you send an HTTP response, all you have to do is tack on an X-Sendfile header with the path of the file you need to send — don’t worry about actually reading the file or sending any of those bytes yourself. The web server will load the file you specified and send it downstream.
This is loads easier on your Rails process (it just sets the headers and gets on with life), and you get all the cool file transfer functionality already baked into your web server (like proper caching, resuming, etc). Of course, you can send any file that the web server can read, not just files in your normal public directory. This makes it perfect for sending private or protected content to specific users of your app.
ruby script/plugin install http://john.guen.in/svn/plugins/x_send_file/
usage
x_send_file('/path/to/file')
x_send_file('/path/to/image.jpg', :type => 'image/jpeg', :disposition => 'inline')
x_send_file('/path/to/file/', :header => 'X-LIGHTTPD-SEND-FILE')
Izmjenjeno od Ernad Husremović prije više od 17 godina
http://tangent.org/528/myhttp_engine.html
projekti:- mod_auth_useragent
- mod_filter
- mod_index_rss
- mod_layout
- mod_memcached
- mod_methods (
- mod_mp3
- mod_random
- mod_relocate
- mod_repository
- mod_text2html
- mod_trigger
Izmjenjeno od Ernad Husremović prije više od 17 godina
- Fajl mod_methods-0.3.tar.gz mod_methods-0.3.tar.gz dodano
mod_methods je baš koristan modul za učenje
Izmjenjeno od Ernad Husremović prije više od 17 godina
file:///data/devel/apache/libapache2-mod-python-3.3.1/doc-html/index.html
Izmjenjeno od Ernad Husremović prije više od 17 godina
odličan primjer: REST with mod_python
http://www.onlamp.com/pub/a/python/2006/02/23/using-rest-with-ajax.html
Izmjenjeno od Ernad Husremović prije više od 17 godina
http://www.bright-interactive.com/python/
We've been using Python, MySQL, Apache and mod_python for some time now and have developed a framework which makes development easier. This framework takes care of:- templating (using Cheetah)
- querying MySQL (using Manager objects)
- sending emails
- debugging (to Apache log or stdout)
- users and security
Izmjenjeno od Ernad Husremović prije skoro 16 godina
- Status promijenjeno iz Dodijeljeno u Odbačeno