Git Product home page Git Product logo

Comments (9)

whatnickcodes avatar whatnickcodes commented on July 29, 2024 5

@DjKush here you go

# vi: set ft=ruby :

Vagrant.configure("2") do |config|

    config.vm.box = "scotch/box"
    config.vm.network "private_network", ip: "192.168.33.10"
    config.vm.hostname = "scotchbox"
    config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

    # Optional NFS. Make sure to remove other synced_folder line too
    #config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }

    config.vm.provision "shell", inline: <<-SHELL
        mv /var/www/public /var/www/public_html
        sudo sed -i s,/var/www/public,/var/www/public_html,g /etc/apache2/sites-available/000-default.conf
        sudo sed -i s,/var/www/public,/var/www/public_html,g /etc/apache2/sites-available/scotchbox.local.conf
        sudo service apache2 restart
    SHELL

end

from scotch-box.

n3rdtastic avatar n3rdtastic commented on July 29, 2024

You can change the vhost in /etc/apache2/sites-available/000-default.conf to set the DocumentRoot to /var/www/public_html. If you want more customization of the vhost, or want it to happen automatically as part of vagrant up, you can use the Vagrant File provisioner to overwrite the 000-default.conf. There might be a better way to do that, but I'm new to Vagrant so that's as good as I've got right now.

from scotch-box.

whatnickcodes avatar whatnickcodes commented on July 29, 2024

You can do this manually by SSHing into the box. Follow these steps:

  • vagrant up
  • vagrant ssh
  • sudo vim /etc/apache2/sites-available/000-default.conf (or the editor of your choosing)
  • Change the document root to "public_html"
  • Run sudo service apache2 restart
  • Rename the public folder to public_html

Alternatively, you can try a provisioning method as well.

from scotch-box.

knynkwl avatar knynkwl commented on July 29, 2024

Hey,

Is there a way to add this to a settings file, so when I start a new project I don't have to ssh in and change this manually?

from scotch-box.

kush1960 avatar kush1960 commented on July 29, 2024

Adding server config would be so useful, shame it can't go in the Vagrantfile

from scotch-box.

whatnickcodes avatar whatnickcodes commented on July 29, 2024

It probably can... Let me get you an example soon

from scotch-box.

whatnickcodes avatar whatnickcodes commented on July 29, 2024

This will automatically change the public folder for you and do all the server stuff. Pretty simple stuff

from scotch-box.

whatnickcodes avatar whatnickcodes commented on July 29, 2024

Also I updated the article: https://scotch.io/bar-talk/announcing-scotch-box-2-0-our-dead-simple-vagrant-lamp-stack-improved#changing-/public-to-/public_html

from scotch-box.

kush1960 avatar kush1960 commented on July 29, 2024

Thanks ncerminara. Some good tips in that article.

from scotch-box.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.