In order to access a server hosted within a vm (guest), for development purposes from the host OS, which is restricted to same origin / localhost only requests, I set up a siple nginx reverse proxy to forward my requests.
- To install in a Windows VM, download and install nginx from the current, stable release; I installed to C:\nginx\
- Edit the <install path>/conf/nginx.conf file with the marked changes in the file of the same name in this gist.
- Start the nginx executable, located in your install path. There are service wrappers for Windows, or you can just kill the process to stop the nginx instance.
Commands for Windows
More information on the implementation of nginx in Windows can be found on the corresponding docs page. Here's the basic breakdown of commands, form within the nginx install directory:
|start nginx||starts the process|
|nginx -s stop||fast shutdown|
|nginx -s quit||graceful shutdown|
|nginx -s reload||config change, graceful shutdown of existing worker proc, starts new|
|nginx -s reopen||re-open log files|
The config file contains a server block, inside which is a location / block. Inside that location block, we need to replace the root and index assignment with a proxy_pass http://127.0.0.1:8080; line and a proxy_http_version 1.1; line.