Bambang Purnomosidi D. P. wrote:
> Dear teman-teman,
>
> Jika saya punya beberapa aplikasi rails, bagaimana untuk membuat semua 
> aplikasi rails tersebut menjadi 1?
>
> Misal saya punya aplikasi A, B, C
> Gimana caranya supaya aplikasi-aplikasi tersebut bisa diakses dengan 
> - http://server/A 
> - http://server/B
> - http://server/C
>
> Rasanya aneh juga kalau harus bikin port yang berbeda2 untuk setiap 
> aplikasi. Apakah dengan mod_proxy Apache + Mongrel? Atau dengan 
> mongrel_cluster?
>
>   
Ya, betul.

Saya menangkap pertanyaan Anda menjadi "bagaimana cara membuat beberapa 
aplikasi terlihat berada dalam satu server, tapi terpisah berdasarkan 
direktori". Betul begitu?

Jika pakai Ruby + FastCGI, sebenarnya tinggal bikin subdirectory aja :-) 
Lalu masukkan aplikasi Rails di subdir yang diinginkan :)

Intinya bikinlah aplikasi tersebut jalan sendiri2 di portnya masing2. 
(jika pakai Mongrel)

Setelah itu gunakan metode reverse proxy di web server kesukaan Anda. 
Misalnya Apache.

Kalo Anda menginstall Apache beserta manualnya silakan buka 
http://localhost/manual/mod/mod_proxy.html ato cari di internet mengenai 
mod_proxy

Ini saya kasih cuplikannya:

    Forward and Reverse Proxies
    Apache can be configured in both a forward and reverse proxy mode.
    An ordinary forward proxy is an intermediate server that sits
    between the client and the origin server. In order to get content
    from the origin server, the client sends a request to the proxy
    naming the origin server as the target and the proxy then requests
    the content from the origin server and returns it to the client. The
    client must be specially configured to use the forward proxy to
    access other sites.
    A typical usage of a forward proxy is to provide Internet access to
    internal clients that are otherwise restricted by a firewall. The
    forward proxy can also use caching (as provided by mod_cache) to
    reduce network usage.
    The forward proxy is activated using the ProxyRequests directive.
    Because forward proxys allow clients to access arbitrary sites
    through your server and to hide their true origin, it is essential
    that you secure your server so that only authorized clients can
    access the proxy before activating a forward proxy.
    A reverse proxy, by contrast, appears to the client just like an
    ordinary web server. No special configuration on the client is
    necessary. The client makes ordinary requests for content in the
    name-space of the reverse proxy. The reverse proxy then decides
    where to send those requests, and returns the content as if it was
    itself the origin.
    A typical usage of a reverse proxy is to provide Internet users
    access to a server that is behind a firewall. Reverse proxies can
    also be used to balance load among several back-end servers, or to
    provide caching for a slower back-end server. In addition, reverse
    proxies can be used simply to bring several servers into the same
    URL space.
    A reverse proxy is activated using the ProxyPass directive or the
    [P] flag to the RewriteRule directive. It is not necessary to turn
    ProxyRequests on in order to configure a reverse proxy.
    topBasic Examples
    The examples below are only a very basic idea to help you get
    started. Please read the documentation on the individual directives.
    In addition, if you wish to have caching enabled, consult the
    documentation from mod_cache.
    Forward Proxy
     ProxyRequests On
     ProxyVia On
     
     <Proxy *>
      Order deny,allow
     Deny from all
     Allow from internal.example.com
      </Proxy>
    Reverse Proxy
     ProxyRequests Off
     
     <Proxy *>
      Order deny,allow
     Allow from all
      </Proxy>
     
     ProxyPass /foo http://foo.example.com/bar
     ProxyPassReverse /foo http://foo.example.com/bar


Teknik tersebut dapat digunakan bukan hanya pada Rails, tapi pada 
aplikasi apapun, dan di server manapun (tidak harus berada di satu 
server fisik!)

Andai yang Anda punya aplikasi PHP yang beda server pun, perintah 
reverse proxy-nya sama persis, tinggal URL-nya saja yang beda. (pada 
directive ProxyPass & ProxyPassReverse)

-- 
Hendy Irawan
www.hendyirawan.com



[Non-text portions of this message have been removed]

Kirim email ke