VVV icon indicating copy to clipboard operation
VVV copied to clipboard

Default Nginx config, #2279

Open Mte90 opened this issue 4 years ago • 8 comments
trafficstars

Should fix https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2279

Checks

  • [ ] I've updated the changelog.
  • [ ] I've tested this PR
  • [x] This PR is for the develop branch not the stable branch.
  • [ ] This PR is complete and ready for review.

Mte90 avatar Jul 21 '21 14:07 Mte90

Thanks for opening this pull request! Make sure CHANGELOG.md gets updated with this change, additionally any docs that need updated can be found at https://github.com/Varying-Vagrant-Vagrants/varyingvagrantvagrants.org

GitHub
The VVV docs and website. Contribute to Varying-Vagrant-Vagrants/varyingvagrantvagrants.org development by creating an account on GitHub.

update-docs[bot] avatar Jul 21 '21 14:07 update-docs[bot]

@Mte90 is some of it missing? I see it reverted a portion in the last commit

tomjn avatar Nov 30 '21 10:11 tomjn

@Mte90 is some of it missing? I see it reverted a portion in the last commit

I changed the if as you suggested.

Mte90 avatar Nov 30 '21 10:11 Mte90

@Mte90 vvv_provision_site_nginx_config still needs calling with the fallback config in the other function

tomjn avatar Nov 30 '21 10:11 tomjn

I misunderstood your request, now should be right (I hope).

Mte90 avatar Nov 30 '21 11:11 Mte90

I think this needs the main develop branch merging into it so that the CI actions pass

tomjn avatar Apr 08 '22 09:04 tomjn

Seems that GitHub doesn't find any conflicts.

Mte90 avatar Apr 08 '22 09:04 Mte90

@Mte90 more so that it pulls in fixes in develop for CI so that it can pass

tomjn avatar Apr 08 '22 10:04 tomjn

@Mte90 can you resolve the conflicts and update this for the latest develop branch?

tomjn avatar Nov 05 '22 20:11 tomjn

Conflicts fixed.

Mte90 avatar Nov 07 '22 13:11 Mte90

@Mte90 I tested this PR and ran into a failed provision with Nginx configs failing due to syntax errors:

vagrant@vvv:~$ sudo nginx -t
nginx: [emerg] directive "server_name" is not terminated by ";" in /etc/nginx/custom-sites/fallback.conf:4
nginx: configuration file /etc/nginx/nginx.conf test failed
vagrant@vvv:~$ 

fallback.conf should not have been included based on my understanding, it's just a template that's used to generate the sites actual Nginx config if the site provides no config of its own ( either because there is no provisioner or none was provided ).

To test this I did these steps:

  • I created a www/wordpress-three/public_html folder and put an index.php inside it with a generic "It works!" type message
  • I then added a wordpress-three site to config.yml that did not have a repo parameter, so no site provisioner was present
  • I then reprovisioned with vagrant up --provision

I suspect part of the problem is the location of the fallback config is in a place where it's automatically included, which is not how it should work. fallback.conf is a template file, much like how we have template files in the site provisioner.

tomjn avatar Nov 13 '22 16:11 tomjn

I moved the file one folder up so it wasn't copied into place, and renamed it to site-fallback.conf, adjusted provision-site.sh accordingly, and re-ran the provision, and got this:

==> default: Running provisioner: site-wordpress-three (shell)...
    default: Running: /var/folders/dw/wdtnsdn154db04ymxv90t9tm0000gn/T/vagrant-shell20221113-84039-12bycqx.sh
    default:  ▷ Running the 'site-wordpress-three' provisioner...
    default:  * The site: 'wordpress-three' does not have a site template, assuming custom provision/vvv-init.sh and provision/vvv-nginx.conf
    default:  * Warning: A site provisioner was not found at .vvv/vvv-init.sh provision/vvv-init.sh or vvv-init.sh, searching 3 folders down, please be patient...
    default:  * Warning: No site provisioner was found, VVV could not perform any scripted setup that might install software for this site
    default:  ! Warning: An nginx config was not found!! VVV needs an Nginx config for the site or it will not know how to serve it.
    default:  * VVV searched for an Nginx config in these locations:
    default:    - /srv/www/wordpress-three/.vvv/vvv-nginx.conf
    default:    - /srv/www/wordpress-three/provision/vvv-nginx.conf
    default:    - /srv/www/wordpress-three/vvv-nginx.conf
    default:  * VVV will search 3 folders down to find an Nginx config, please be patient...
    default:  ! Error: No nginx config was found, VVV will not know how to serve this site
    default:  ! The 'site-wordpress-three' provisioner ran into problems, the full log is available at '/var/log/provisioners/2022.11.13_16-28-19/provisioner-site-wordpress-three.log'. It completed in 0 seconds.

tomjn avatar Nov 13 '22 16:11 tomjn

Pushed up fixes

tomjn avatar Nov 13 '22 17:11 tomjn