Table of Contents
Installation instructions for HasteBin.
Debian and derivates
-
Install dependencies
sudo apt-get install g++ curl libssl-dev apache2-utils sudo apt-get install git-core sudo apt-get install redis-server
-
Install node.js
git clone https://github.com/nodejs/node cd node ./configure make sudo make install
-
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
You can get a haste server setup running quickly on Cloudron by installing it from the Cloudron Store (For those unaware, Cloudron is a complete solution for running apps on your server and keeping them up-to-date and secure):
The source code for the package can be found here.
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>
bwac.pro