Multi sites on localhost
  • Hi guys,

    I'm trying to set up multi sites on localhost, but can't seem to get anything other than 'No Site!'.

    My locomotive.rb file has:

    config.multi_sites do |multi_sites|
    multi_sites.domain = 'localhost:8080'
    multi_sites.reserved_subdomains = %w(site1 site2)
    end


    and I've adjusted my hosts file to include:

    127.0.0.1 localhost
    127.0.0.1 site1.localhost
    127.0.0.1 site2.localhost


    I then restarted locomotive. But now if I go to any of:
    • localhost:8080/
    • site1.localhost:8080/
    • site2.localhost:8080/

    ...I just see "No Site!"

    Is there something I'm missing?
    (I'm a noob developing on a Mac running OSX 10.6.8, Rails 3.0.10 & Ruby 1.9.2p290)
    -- Cam
  • I think you are confusing the usage of the "multi_sites.reserved_subdomains".
    The subdomain you are putting there are the ones you can NOT use. You should remove that, and then create in loco 2 other websites using site1 and site2.
  • Thanks Chewbie - your reply is much appreciated.

    I've now updated my locomotive.rb file to display:

    config.multi_sites do |multi_sites|
    multi_sites.domain = 'localhost:8080'
    multi_sites.reserved_subdomains = %w()
    end


    and restarted Locomotive, but am still seeing 'No Site!' at http://localhost:8080/
    (I noted that if I switch back to config.multi_sites = false, I CAN see my site. I also tried using just 'localhost' in the code above - without the port - but, still 'No Site!' is all I see. )

    Any other suggestions as to what I might try next? Have I used the correct syntax for multi_sites.reserved_subdomains?
    -- Cam

  • I would try to put another value than localhost in multi_sites.domain = 'localhost:8080' . Something along the line of "fakedomain.com" and configure your host file accordingly.

    You should also probably put something in multi_sites.reserved_subdomains (just in case the empty array is not supported).

    After that try to see if you have somewhere an admin access (fakedomain.com/admin responding?). If it's not responding then it might be that you database contain some data that is not in synch with the multidomain (especially if when you configure multi_sites = false, that makes me think it might be the case). It could be worth to try to synch to a new database and go multi_sites since the beginning.
  • Has anyone got multiple sites working on Locomotive yet?
  • On heroku deployment, yes i got it to work!
  • how about local? I put in a few host names in the /etc/hosts. plus changed the multi_sites config in the locomotive.rb like chewbie suggested. The logs show nothing specific neither is there any mongodb connection problems. The browser keeps loading forever.
  • never mind guys! it was silly. the flag had to be set before i configure the multi_sites. smh!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!