Issue
I have Apache running on a Mint VM on a Windows 8 host so I can use the VM for Drupal development. I created a VirtualHost entry in /etc/apache2/apache2.conf
so I can use www.mysite.dev
as a development URL, and I set up the hosts
files on the guest host machines. The target platform for deployment is Acquia, in case that's relevant.
The problem I'm having is that, when use a browser in the guest to go to http://www.mysite.dev/
, I get my site, but when I access http://www.mysite.dev/any-non-root-path
, I get a 404. Also, when I use a browser on the host to go to http://www.mysite.dev
, I instead get the Apache default home page.
In /etc/apache2/apache2.conf
on the guest, I have:
<VirtualHost www.mysite.dev:80>
DocumentRoot /var/www/html/mysite/docroot/
ServerName www.mysite.dev
</VirtualHost>
In /etc/hosts
on the guest, I have:
127.0.0.1 localhost
127.0.1.1 vm-name
127.0.0.1 www.my-site.dev
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
In C:\Windows\System32\drivers\etc\hosts
on the host, I have
127.0.0.1 localhost
192.168.44.44 www.drupal7.dev
192.168.44.45 www.mysite.dev
192.168.44.45 is the IP address of the VM on the host-only network I created in VirtualBox. (The 192.168.44.44 is from when I was trying Vagrant, but the shared folder performance was too slow. I figured instead of learning Vagrant just to muck around, I might as well skip straight to the muck!)
I suspect the two issues I'm having are related. So my question is this: how can I resolve these two issues so I get the content I want both while browsing from the host and while browsing from the guest?
Thanks!
edit The specific error I was getting for the path issue was The requested URL [...] was not found on this server.
Solution
New Answer: This answer solves both problems.
<VirtualHost 192.168.44.45 127.0.0.1>
DocumentRoot /var/www/html/site-name
ServerName www.site-name.dev
<Directory "/var/www/html/site-name/docroot/">
AllowOverride All
</Directory>
</VirtualHost>
So that's the answer, Mr. Spock!
Original Answer So a fresh look Monday morning got me part of the answer. I guess this is really two questions.
The fix to the non-root URL was to add a directory element. See https://www.drupal.org/node/1038.
<VirtualHost www.site-name.dev:80>
DocumentRoot /var/www/html/site-name
ServerName www.site-name.dev
<Directory "/var/www/html/site-name/docroot/">
AllowOverride All
</Directory>
</VirtualHost>
I'm still looking into the other part.
Answered By - Becca Dee Answer Checked By - Robin (WPSolving Admin)