grunt-reload icon indicating copy to clipboard operation
grunt-reload copied to clipboard

Can this be used with PHP sites and Virtual Hosts?

Open cerebralideas opened this issue 11 years ago • 6 comments

I use MAMP with virtual hosts using port 80. I can't seem to figure out exactly how to configure the reload config. Here's how I want to write it:

reload: {
    port: 80,
    proxy: {
        host: 'dev.mywebapp.site'
    }
}

This may be a stupid question, but can this also work with PHP sites that don't have a root index.html file?

cerebralideas avatar Sep 25 '12 05:09 cerebralideas

+1 on this!

zigotica avatar Oct 16 '12 21:10 zigotica

Same issue with the virtual hosts. I've tried using

    reload: {
      proxy: {
        host: 'susydemo'
      }
    },

and my output in terminal is as follows:

Running "reload" task
Proxying http://susydemo:80/
reload server running at http://localhost:8001

imjared avatar Dec 17 '12 20:12 imjared

Managed to get it working with the following:

    // added server under grunt.initConfig
    server: {
      base: 'http://susydemo'
    },
    reload: {
      proxy: {
        port: 80,
        host: 'susydemo' // is the name of my vhost
      }
    },
    watch:{
        files:['index.html', 'style.less'],
        tasks:'default reload'
    },
    // etc...

imjared avatar Dec 17 '12 20:12 imjared

Thanks @imjared for sharing your fix, but unfortunately, it didn't work for me. Here's my related grunt config:

server: {
    base: 'http://phi.site'
},
reload: {
    proxy: {
        port: 80,
        host: 'phi.site'
    }
}

I'm still getting the following even after adding the server configuration:

Running "reload" task
Proxying http://phi.site:80/
reload server running at http://localhost:8001

Did you happen to do more than just add the server config? Thanks in advance for any help you may be able to offer :)

cerebralideas avatar Dec 18 '12 01:12 cerebralideas

Is http://phi.site:80 accessible? If so, try hitting http://phi.site:8001, make a change to index.html with grunt watch running, and hopefully you'll see magic.

If that doesn't work for you, I'm afraid I won't be too much more help :disappointed:

imjared avatar Dec 18 '12 01:12 imjared

Thanks for the reply @imjared, http://phi.site:80 works, but http://phi.site:8001 does not. I tried adding port: 80 to the grunt file like so:

server: {
    base: 'http://phi.site'
},
reload: {
    port: 80, // added this
    proxy: {
        port: 80,
        host: 'phi.site'
    }
} 

But, that didn't help either. The problem is I'm not familiar with ports and such, so I'm not really sure what the different ports are supposed to reflect. Oh well, thanks for trying to help :)

cerebralideas avatar Dec 18 '12 01:12 cerebralideas