1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-12-24 11:06:59 +00:00
13 Installation
Girish Ramakrishnan edited this page 2020-06-11 12:07:31 -07:00

Installation instructions for HasteBin.

Debian and derivates

  1. Install dependencies

    sudo apt-get install g++ curl libssl-dev apache2-utils
    sudo apt-get install git-core
    sudo apt-get install redis-server
    
  2. Install node.js

    git clone https://github.com/nodejs/node
    cd node
    ./configure
    make
    sudo make install
    
  3. Install and start hastebin

    git clone git://github.com/seejohnrun/haste-server.git
    cd haste-server
    npm install
    npm install hiredis #optional
    npm start
    

And you should have hastebin! Note: It will run on port 7777 by default

Gentoo

Use ebuild www-apps/haste-server from the CVUT Overlay (runscript included).

Cloudron

Haste server is available as a 1-click install on Cloudron. Cloudron makes it easy to run apps like Haste server on your server and keep them up-to-date and secure.

Install

The source code for the package can be found here.

There is a demo instance (username: cloudron password: cloudron) where you can experiment with running Haste server.

Proxy configuration

source: http://www.ctrl-alt-del.cc/2014/11/haste-server-base-url-hackpatch.html

HAProxy

     frontend shared-http-frontend
            mode http
            bind 0.0.0.0:80
            default_backend main_website
            # ACLs for request routing
            acl acl_haste path_beg /haste/
            use_backend haste_backend if acl_haste

    backend haste_backend
            server haste 127.0.0.1:7777
            reqirep ^([^\ :]*)\ /haste/(.*)   \1\ /\2 

    backend main_website
            server main_web 127.0.0.1:8000

Nginx

    location ^~ /haste/ {
            proxy_buffering  off;
            rewrite                /haste/(.*) /$1 break;
            proxy_pass         http://127.0.0.1:7777/;
            proxy_redirect    default;
    }

Lighttpd

    server.modules   += ( "mod_rewrite", "mod_proxy" ) 

    # Matching Proxy
    #
    $HTTP["url"] =~ "(^/haste/)" {
      proxy.server  = ( "" => (
        "servername:80" => # name
          ( "host" => "127.0.0.1",
            "port" => 82
          )
        )
      )
    }

    # URL Rewriting Proxy
    #
    $SERVER["socket"] == "127.0.0.1:82" {
      url.rewrite-once = ( "^/haste/(.*)$" => "/$1" )
      proxy.server  = ( "" => (
        "servername:82" => # name
          ( "host" => "127.0.0.1", # Set the IP address of servername
            "port" => 7777
          )
        )
      )
    }

Apache

First we need to enable mod_proxy and mod_proxy_http:

    a2enmod proxy
    a2enmod proxy_http

Then add to the vhost configuration file:

    ProxyPass /haste/ http://127.0.0.1:7777/
    ProxyPassReverse /haste/ http://127.0.0.1:7777/

So that the full config looks like this

<VirtualHost *:80>
    ServerAdmin xxx@xxx.com
    ServerName xxx.com
    ServerAlias www.xxx.com
    ProxyPass / http://127.0.0.1:7777/
    ProxyPassReverse / http://127.0.0.1:7777/
    ErrorLog log/log.log
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
</VirtualHost>

This will also work

<VirtualHost *:80>
    ServerAdmin xxx@xxx.com
    DocumentRoot /var/www/xxxhaste-server
    ServerAlias xxx.com
    ServerName www.xxx.com
    ErrorLog logs/log.log
    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass / http://localhost:7777/
    ProxyPassReverse / http://localhost:7777/
</VirtualHost>