Articles Comments

Headline

Using Nginx as reverse proxy

It’s common knowledge that when you’re serving a web application you shouldn’t use a standard Apache install to serve static assets, as it comes with too much overhead. I won’t go into the details of why here, as it’s been covered by many other people better qualified than I. What I can do, however, is tell you how I set up Nginx, which is a super light–weight web server, on my VPS here on Slicehost (who are awesome, by the way). Quick theory Just quickly, the theory is that Nginx listens on port 80, and subsequently sends requests for certain URL patterns through to the mod_wsgi server (in my case, Apache) listening on a different port. This server currently serves the meat of my Django site. Static assets (JS, CSS, images) are served … Read entire article »

Latest

How and why to use the Apache proxy server

Even if you have no interest in serving web pages from your new OS X box, there’s at least one feature of Apache (the built-in web server) that you might want to put to use – the proxy server. A proxy server is nothing more than a server which sits between a client (such as a web browser) and a real server (such as a web host). It intercepts all requests sent by the client and decides if it can handle the request itself. If it cannot, it then passes the request on to the real server. Why might you find this useful? There are two primary reasons. First, if you’re a parent, you can use the … Read entire article »

How To Secure Apache Proxy Server (mod_proxy)

Q. I’ve proxy (mod_proxy) enabled for Apache under Debian Linux 4.0 server. I’d like to use this to improve performance, but I don’t want an open proxy that can be used by anyone on the Internets? How do I secure my proxy as limiting access is essential as I’m using a forward proxy? A. You can easily restrict proxy access to single domain, IP or subnet. Forward proxy example You can control who can access your proxy via the control block. Use configuration as follows to allow access from your-domain.com only: Order deny,allow Deny from all Allow from your-domain.com OR allow access from 10.1.5 only Order deny,allow Deny … Read entire article »

Nginx proxy to Apache – access remote host IP address using mod_praf

These days it i getting more and more common for people to use a lightweight webserver such as lighttpd or nginx as a frontend, and proxy to an Apache backend if they really need to. There is however a small problem when using Apache as a backend, as it will see all requests as originating from localhost (127.0.0.1). So, if you need access to the users real IP address in your application, you will need to install the mod_praf apache module and configure Apache to use the and X-Real-IP headers that gets sent by nginx. First, set up a name based apache virtual host listening on port 8080: NameVirtualHost *:8080 ServerName mydomain.com ServerAdmin me@mydomain.com … Read entire article »

Taking a load off: Load balancing with balance

A server is limited in how many users it can serve in a given period of time, and once it hits that limit, the only options are to replace it with a newer, faster machine, or add another server and share the load between them. A load balancer can distribute connections among two or more servers, proportionally cutting the work each has to do. Load balancing can help with almost any kind of service, including HTTP, DNS, FTP, POP/IMAP, and SMTP. There are a number of open source load balancing applications, but one simple command-line load balancer, balance, remains one of the most popular available. Ideally you should install a load balancer on a dedicated machine … Read entire article »