0

I've been trying to get lighttpd or apache2 (I prefer lighttpd) to work behind a proxy but no luck so far.

What I want is to run lighttpd (or port 80) behind a proxy, so that when someone goes to some.website.com, and the DNS for that domain is pointed to the IP address of the proxy server, they end up on my http server's page.

This would allow me to use the server's resources, while keeping it's IP address hidden.

Unfortunately, using the proxychains program did not work. For lighttpd it gave the error getaddrinfo failed: Unknown error ' ::' and proxychains apache2 start started just fine, but it didn't seem to do anything. I did test if the proxychains program itself worked, and it used the proxy just fine using curl on a what-is-my-ip type of website.

If you're wondering; I am temporarily using a homeserver, and I don't want to make my IP address public.

Any ideas? Both a HTTPS proxy (squid) or a SOCKS5 (dante) proxy will do just fine.

natli
  • 245
  • 2
  • 14

4 Answers4

0

An example without VirtualHost on the proxy server:

<Location /<stuff after domain name of proxy server>/>
    ProxyPreserveHost On

    ProxyPass http://<localIP>:<localPort>/
    ProxyPassReverse http://<localIP>:<localPort>/
</Location>

An example with virtual host on the proxy server:

<VirtualHost *:80>
  ServerName <subdomainname>.<example.com>

  ProxyPreserveHost On
  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyRequests On
  ProxyPreserveHost On
  ProxyPass / http://<localIP>:<localPort>/
  ProxyPassReverse / http://<localIP>:<localPort>/

</VirtualHost>

Edit: Both working on apache2

0

Using Apache and mod_proxy you could write one or more simple rules such as

ProxyPass /foo http://internal-ip/bar

This way the Apache server hides the internal server(s).

Ladadadada
  • 26,337
  • 7
  • 59
  • 90
erikxiv
  • 147
  • 2
  • 12
  • I already tried mod_proxy. I set up an ssh connection to the proxy server in Daemon mode using port 5555, and then added `ProxyPass / http://localhost:5555` to the config, but it didn't do anything. – natli Apr 19 '12 at 13:44
  • I've probably misunderstood something. Why SSH, why did you set up a connection and why localhost? I though the scenario was that a HTTP reqyest was made from the Internet to the Proxyy server, which then redirected the HTTP request to the internal server? – erikxiv Apr 19 '12 at 13:47
  • I should have been more clear, this is why I used SSH to get the proxy connection: [link to article](http://opensource.osu.edu/node/122) . And yes, that's exactly what I'm trying to do. – natli Apr 19 '12 at 13:53
  • I believe that proxychains allow you to start a program on your client machine and route all the network traffic from that program through SSH to your SSH server, essentially acting as if the program (such as a web browser) were running on the SSH server (inside your local network). Is that what you want to achieve? If so, you should not use neither Apache nor lighttpd, but only proxychains. – erikxiv Apr 19 '12 at 14:32
  • Proxychains didn't do anything, as I stated in my question. I don't know why it doesn't just work.. it should ;/ And how would I be serving web pages if I wasn't using apache or lighttpd? I'm trying to run a server here, not visit some website using a proxy. Someone request page -> Proxy sends request to http server -> http server serves page to proxy server -> proxy server forwards page to requester. – natli Apr 19 '12 at 19:52
0

The proxy that you chose must support "reverse HTTP proxying". See: http://en.wikipedia.org/wiki/Reverse_proxy

Mircea Vutcovici
  • 17,619
  • 4
  • 56
  • 83
0

You mentioned that squid would work just fine. Is there a reason you didn't just fire up squid? It's probably the simplest proxy solution to configure.

Tad
  • 133
  • 2
  • 11