The Diary of Aska

Reverse proxy of virtual hosts with Nginx

Apache is not needed.

INSTALL (Ubuntu)

sudo aptitude install nginx
sudo /etc/init.d/nginx start

VirtualHost and ReverseProxy

This server's configuration.

# /etc/nginx/sites-enabled/7kai.org

proxy_set_header  X-Real-IP       $remote_addr;
proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header  Host            $http_host;
proxy_redirect    off;
proxy_max_temp_file_size          0;

server {
  listen      80;
  server_name doc.7kai.org;
  location / { proxy_pass http://localhost:5000; }
}

server {
  listen      80;
  server_name blog.7kai.org;
  location / { proxy_pass http://localhost:5001; }
}