Hosting website from VirtualBox shared path
Posted: 13. March 2022 15:46
Howdy!
I need to do some offsite work on a WordPress site so I packed things up, created an Ubuntu VirtualBox, installed Local by Flywheel, installed a WordPress instance to my shared folder, migrated my site and everything was fine...inside VirtualBox. I couldn't access the site from my Host.
Accessing a site running within VirtualBox from the host had never been a problem when I did straight-up apache installs, but I had never done it using a shared folder and that's where the trouble began, permissions-wise, which brings me here today.
I did a fresh install of Ubuntu 21.10. I ran the updates, installed Guest Additions, and installed XAMPP. At this point I could access http://localhost within VirtualBox and from the host by http://[computer name or IP] and that's where the help I'm seeking comes in.
I set permissions for my user account and the apache user group to access files on the shared folder:
After that I could do whatever I wanted to the shared folder as myself but that did not appear to give Apache the necessary rights as switching to my site and hitting localhost returns this error:
This is my httpd-vhosts.conf file:
On a separate issue I'd like to keep the default XAMPP website available mostly because of phpmyadmin but when I add this to httpd-vhosts.conf I cannot go to localhost:8080
The most important thing is just to get my site up being served from the VirtualBox shared folder, so any advice is greatly appreciated.
Thanks,
Chris
I need to do some offsite work on a WordPress site so I packed things up, created an Ubuntu VirtualBox, installed Local by Flywheel, installed a WordPress instance to my shared folder, migrated my site and everything was fine...inside VirtualBox. I couldn't access the site from my Host.
Accessing a site running within VirtualBox from the host had never been a problem when I did straight-up apache installs, but I had never done it using a shared folder and that's where the trouble began, permissions-wise, which brings me here today.
I did a fresh install of Ubuntu 21.10. I ran the updates, installed Guest Additions, and installed XAMPP. At this point I could access http://localhost within VirtualBox and from the host by http://[computer name or IP] and that's where the help I'm seeking comes in.
I set permissions for my user account and the apache user group to access files on the shared folder:
- Code: Select all
sudo adduser chris vboxsf
sudo usermod -a -G vboxsf www-data
After that I could do whatever I wanted to the shared folder as myself but that did not appear to give Apache the necessary rights as switching to my site and hitting localhost returns this error:
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.52 (Unix) OpenSSL/1.1.1m PHP/8.1.2 mod_perl/2.0.11 Perl/v5.32.1
This is my httpd-vhosts.conf file:
- Code: Select all
<VirtualHost *:80>
DocumentRoot "/media/sf_clubdevwin/outlawvern/"
ServerName localhost
<Directory /media/sf_clubdevwin/outlawvern>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /media/sf_clubdevwin/outlawvern/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
On a separate issue I'd like to keep the default XAMPP website available mostly because of phpmyadmin but when I add this to httpd-vhosts.conf I cannot go to localhost:8080
- Code: Select all
<VirtualHost *:80>
DocumentRoot "/opt/lampp/htdocs/"
ServerName localhost
</VirtualHost>
The most important thing is just to get my site up being served from the VirtualBox shared folder, so any advice is greatly appreciated.
Thanks,
Chris