Comments (9)
@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.
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.
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.
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.
Adding server config would be so useful, shame it can't go in the Vagrantfile
from scotch-box.
It probably can... Let me get you an example soon
from scotch-box.
This will automatically change the public folder for you and do all the server stuff. Pretty simple stuff
from scotch-box.
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.
Thanks ncerminara. Some good tips in that article.
from scotch-box.
Related Issues (20)
- PHP Version with Pro
- Guest additions version outdated/incompatible HOT 3
- Can we get scotch.io to a LTS dist?
- SB 3.5 shows default home page for every project HOT 2
- Vagrant Up - Unable To Fetch HOT 2
- There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below. HOT 1
- Laravel mix not working by default HOT 1
- Ubuntu 17.10 is EOL, and provisioning new box now fails as a result HOT 7
- Error with Craft CMS on Installation
- 38456 HOT 1
- Vagrant up not working HOT 1
- Vagrant up not working (MacOS) HOT 1
- Scotch Box 3.5 not running on macOS Catalina HOT 2
- Uncaught Error: Class 'PDO' not found HOT 1
- 403 Forbidden error when using NFS on MacOS Catalina HOT 1
- Invalid link HOT 1
- For NodeJS apps: nodemon doesn't work HOT 1
- PHP 5.6 is installed by default on the free version HOT 2
- the php version need be update to 7.4 HOT 1
- vagrant up error: HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scotch-box.