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 2 Open up Terminal and enter the following
git clone https://github.com/naistangz/nginx-reverse-proxy.git
You will need the following:
- Vagrant
- Virtual Box
- Ruby - Preinstalled in Mac
- Bundler or
gem install bundler
in Terminal after Ruby has been installed.
$ 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
- Change directory (cd) into the project
$ cd nginx-reverse-proxy
- Run vagrant in the
nginx-reverse-proxy
folder
$ vagrant up
- Once the virtual machines have run it should return:
Your app is ready and listening on port 3000
- Enter the following links into the browser: