Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 54 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.berkshelf.enabled = true
config.berkshelf.berksfile_path = 'Berksfile'

config.vm.network "private_network", ip: "192.168.50.4"
config.vm.provider 'virtualbox' do |vbox|
vbox.customize ['modifyvm', :id, '--memory', 1024]
vbox.customize ['modifyvm', :id, '--cpus', 2]
Expand All @@ -25,7 +26,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
nginx: {
:servers => {
:'sugar.pmsipilot.com' => {
:port => 8888,
:port => 80,
:upstreams => {
:sugar => {
:ip => 'sugar',
Expand All @@ -36,14 +37,64 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
{
:path => '/',
:alias => '/sugar',
:protocol => 'http',
:upstream => :sugar

}
]
},
:'demobi.pmsipilot.com' => {
:port => 80,
:upstreams => {
:demobi => {
:ip => 'srv-demo-pbi1',
:port => 443

}
},
:locations => [
{

:path => '/',
:alias => '/',
:protocol => 'https',
:upstream => 'srv-demo-pbi1'


}

]



},
:'demo.pmsipilot.com' => {

:port => 80,
:upstreams => {
:demo => {
:ip => 'srv-demo',
:port => 80


}

},


:locations => [

{
:path => '/',
:protocol => 'http',
:upstream => 'srv-demo'
}
}

]
}
}
}

}
chef.run_list = %w(
recipe[nginx]
recipe[nginx-config]
Expand Down
4 changes: 2 additions & 2 deletions templates/default/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ server {

<% @server['locations'].each do |location_def| %>
location <%= location_def['path'] %> {
proxy_pass http://<%= location_def['upstream'] %><%= location_def['alias'] %>/;
proxy_redirect http://<%= location_def['upstream'] %><%= location_def['alias'] %>/ <%= location_def['alias'] %>/;
proxy_pass <%= location_def['protocol'] %>://<%= location_def['upstream'] %><%= location_def['alias'] %>/;
proxy_redirect <%= location_def['protocol'] %>://<%= location_def['upstream'] %><%= location_def['alias'] %>/ <%= location_def['alias'] %>/;
proxy_set_header Host $proxy_host;
proxy_set_header X-Real-IP $remote_addr;
}
Expand Down