Slick top-level-domain style URLs for your local development sites on Ubuntu (and Mac OS X running Ubuntu in a VM)
In order for the cool myprojectname.dev style addresses for sites you are developing locally (rather than 127.0.0.1/myprojectname) from my Mac OS X environment as well as Ubuntu running in a virtual machine, this method uses the IP address available locally that you can find out by typing ifconfig in a shell terminal. It's what follows the text "inet". With luck that is a stable IP address, running in bridged mode (i think) with VMWare Fusion this seems to be working so far. The problem with bridged mode is that it only works with your own internet connection. (Note to VMWare support on getting a stable IP.)
sudo gvim /etc/hosts
192.168.1.104 dev
192.168.1.104 agaric.dev anjali.dev cbs.dev data.dev definitivedrupal.dev genarts.dev openmedia.dev pwgd.dev visionsunite.dev
Put the exact same code in the Mac OS X hosts file, on your Macintosh, sudo vi /private/etc/hosts.
In your linux server, create a new file for this, the number that goes in is your VirtualHost declaration is the same one from the Inet string in the ifconfig output.
gvim /etc/apache2/sites-available/dev
<VirtualHost 192.168.1.104:80>
UseCanonicalName Off
ServerAdmin webmaster@agaric.com
VirtualDocumentRoot /home/ben/code/%1/drupal
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/ben/code>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log vhost_combined
</VirtualHost>
Then:
sudo enmod vitual_alias (or something like that, sorry, computer crashed while writing this up the first time-- not because of any of this, flaky battery). [You can just try the below commands, and if everything works you already have the module necessary for using a Virtual Document Root enabled, and if not just take "mod_" off the name in the error it gives you and put sudo enmod in front of that. That scientific method is what worked for me.]
sudo ensite dev
sudo /etc/init.d/apache2 reload
Comments
Post new comment