Amer Almadani 2016-12-05 17:03:15 +03:00
parent b71c2f8bf7
commit 8b5edb02a9
1 changed files with 111 additions and 1 deletions

@ -39,4 +39,114 @@ Use ebuild [www-apps/haste-server](https://github.com/cvut/gentoo-overlay/tree/m
## Cloudron ## Cloudron
You can get a hastebin setup running quickly using Cloudron: You can get a hastebin setup running quickly using Cloudron:
https://cloudron.io/appstore.html#com.hastebin.cloudronapp https://cloudron.io/appstore.html#com.hastebin.cloudronapp
## 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>
```