README.md in vagrant-reverse-proxy-0.3.1 vs README.md in vagrant-reverse-proxy-0.4.0
- old
+ new
@@ -23,35 +23,48 @@
## Usage
First, install NGINX and create a configuration as usual. Then, in
the `server` configuration block for the host you want to use for
-proxying, simply put `include "vagrant-proxy-config";` in the file.
+proxying, simply put `include "vagrant-proxy-config-locations";` in the file.
If you don't need anything specific, just put the following in
`/etc/nginx/sites-enabled/default`:
server {
- listen [::]:80 default ipv6only=off;
+ listen 80 default;
+ listen [::]:80 default;
# This is the fallback server
server_name default;
# Redirect http://localhost/hostname/lalala
# to http://hostname/lalala
- include "vagrant-proxy-config";
+ include "vagrant-proxy-config-locations";
}
This will load the `/etc/nginx/vagrant-proxy-config` file which is
managed by this plugin. This file contains `location` statements for
each of your virtual machines, such that `http://localhost/foo` will
proxy to port 80 on the virtual machine with a `config.vm.hostname`
value of `foo`. This is only done for virtual machines that have
`config.reverse_proxy.enabled` set to `true` in their config.
-Whenever you bring up or halt a machine, the plugin updates the proxy
-config file and invokes `sudo systemctl reload nginx` to make the
-change immediately visible.
+#### Server Blocks
+The plugin also writes `server` block configuration for the enabled
+VMs so that they can be accessed directly via their hostname (as long
+as the hostname resolves to the host machine's IP address).
+
+To include these, simply include the generated file inside your main NGINX `http` block:
+
+ http {
+ include "vagrant-proxy-config-servers";
+ }
+
+
+Whenever you bring up, halt, or reload a machine, the plugin updates the proxy
+config files and invokes `sudo nginx -s reload` to make the change immediately visible.
+
### Custom host names
Sometimes you want to support several virtual hosts for one VM. To
set that up, you can override the `vhosts` option:
@@ -70,19 +83,29 @@
}
As you can see, this allows you to define which port to connect to
instead of the default port (which is port 80).
-### Specifying the NGINX configuration file path
+### Specifying the NGINX configuration file paths
-If you want to change the location of the managed nginx configuration file, set the `config.reverse_proxy.nginx_config_file` value to a path on your host machine in the Vagrantfile configuration:
+If you want to change the location of the managed NGINX configuration
+files, set the `config.reverse_proxy.nginx_locations_config_file` or
+`config.reverse_proxy.nginx_servers_config_file` values to paths on
+your host machine in the Vagrantfile configuration:
- config.reverse_proxy.nginx_config_file = '/usr/local/etc/nginx/vagrant-proxy-config'
+ config.reverse_proxy.nginx_locations_config_file = '/usr/local/etc/nginx/vagrant-proxy-config-locations'
+ config.reverse_proxy.nginx_servers_config_file = '/usr/local/etc/nginx/vagrant-proxy-config-servers'
+If you don't want to generate one of the locations or server configuration files, set the appropriate config value to `nil`.
+
### Specifying the NGINX reload command
-After the NGINX configuration file is generated, a reload command is executed so that the changes take effect. By default the command executed is `sudo nginx -s reload`. If you need to change this, set the `config.reverse_proxy.nginx_reload_command` option to the command to be executed:
+After the NGINX configuration file is generated, a reload command is
+executed so that the changes take effect. By default the command
+executed is `sudo nginx -s reload`. If you need to change this, set
+the `config.reverse_proxy.nginx_reload_command` option to the command
+to be executed:
config.reverse_proxy.nginx_reload_command = 'sudo service nginx reload'
## Adding proxy support to your application
@@ -111,9 +134,14 @@
add a bit of custom code there if you need to override the base URL.
## Changelog
+- 0.4.0 Add support for `vagrant reload`, add support for host-based instead
+ of location-based dispatching (both thanks to Sam Stevens). NOTE: This is a
+ backwards incompatible change: the default name of the config file has
+ changed, so you must update the `include` statement in your NGINX config.
+- 0.3.1 Allow overriding the NGINX reload command (thanks to Sam Stevens).
- 0.3 Allow overriding the location of the NGINX configuration file
(thanks to Sam Stevens). Support multiple VMs in a single Vagrant
config (suggested by Nicholas Alipaz).
- 0.2 Support for proxying of multiple ports in `vhosts` config.
- 0.1 First version