Skip to content

naistangz/nginx-reverse-proxy

Repository files navigation

Nginx Reverse Proxy

  • For the extended documentation, click here
  • To read more about Vagrant and Virtual Machines, click here

Introduction

Nginx is a popular open-source web server. It can be useful to run on a virtual machine when hosting multiple websites. The general solution for running two web servers on a single system is to either use multiple IP addresses or different port numbers. This project demonstrates how to configure Nginx as a reverse proxy.

To get started download the zip file or git clone this repository onto your local machine

Option 1 screenshot_download_zip

Option 2 Open up Terminal and enter the following

git clone https://github.com/naistangz/nginx-reverse-proxy.git

Prerequisites

You will need the following:

  1. Vagrant
  2. Virtual Box
  3. Ruby - Preinstalled in Mac
  4. Bundler or gem install bundler in Terminal after Ruby has been installed.

Checking versions for dependencies

$ vagrant --version
Vagrant 2.2.9
$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
$ bundle --version
Bundler version 2.1.4

Running the Virtual Machines

  1. Change directory (cd) into the project
$ cd nginx-reverse-proxy
  1. Run vagrant in the nginx-reverse-proxy folder
$ vagrant up 
  1. Once the virtual machines have run it should return:
Your app is ready and listening on port 3000
  1. Enter the following links into the browser:

http://development.local/

http://development.local/fibonacci/8

http://development.local/posts