Seravo / wp-vagrant

Vagrant box for the Seravo WordPress project template
https://seravo.com/docs/
MIT License
18 stars 3 forks source link

Browsersync constantly emits errors #34

Closed ottok closed 3 years ago

ottok commented 7 years ago

The error log is constantly filled with BrowserSync service errors. Viewing the BrowserSync page does not work either.

==> /data/log/nginx-error.log <==
2017/03/11 20:38:42 [error] 2899#0: *177 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.25.1, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:1337/", host: "wordpress.local"

==> /data/log/nginx-error.log <==
2017/03/11 20:40:51 [error] 2899#0: *208 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.25.1, server: browsersync.*, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:1338/favicon.ico", host: "browsersync.wordpress.local", referrer: "https://browsersync.wordpress.local/"
ottok commented 7 years ago

It seems browser-sync cannot run by default, but must be hooked to assets via gulp: https://seravo.com/docs/development/gulp/

ottok commented 7 years ago

Implement commands wp-browsersync-on and wp-browsersync-off so that browsersync can be disabled. See #39.

ottok commented 7 years ago

Extra feature:

When wp-browsersync-on is run, it could check with wp option get siteurl if the site has http or https, and automatically edit the gulpfile and /etc/nginx/sites-enabled/default to run with https so Browsersync can works with https.

ottok commented 7 years ago

For https support:

gulpfile.js

    browserSync.init({
        // browsersync with a php server
        proxy: "https://localhost:8080",
        https: {
          key: "/data/wordpress/.vagrant/ssl/development.key",
          cert: "/data/wordpress/.vagrant/ssl/development.crt"
        },

/etc/nginx/sites-enabled/default

upstream: https://wordpress;
l3ku commented 7 years ago

I managed to get browsersync working (UI not working) with https when using: gulpfile.js

    browserSync.init({
        // browsersync with a php server
        proxy: "http://localhost:8080",
        https: {
          key: "/data/wordpress/.vagrant/ssl/development.key",
          cert: "/data/wordpress/.vagrant/ssl/development.crt"
        },

/etc/nginx/sites-enabled/default

upstream: https://wordpress;

Some notices I made:

l3ku commented 7 years ago

Development in progress at https://github.com/Seravo/wp-palvelu-vagrant/tree/feature-wp-xdebug-commands. HTTPS support for Browsersync has not yet been implemented into the scripts due to the problems mentioned in the previous comment on this issue.

ottok commented 3 years ago

This should be fixed and tested in parallel with https://github.com/Seravo/wordpress/issues/140

frimro commented 3 years ago

Could not replicate Browsersync errors. The UI works fine as well. Closing for now, as the issue is quite old.