One directory for UAT and Local and Enabling Apache Sites

We normally work on windows with netbeans and we have an ubuntu box with apache as a dev environment.

Instead of have to different directories one for UAT (dev environment where the clients can see what we are doing) and my local server for debugging what we do is to have one single directory that we use locally with netbeans

linux.jpg

We normally work on windows with netbeans and we have an ubuntu box with apache as a dev environment.

Instead of have to different directories one for UAT (dev environment where the clients can see what we are doing) and my local server for debugging what we do is to have one single directory that we use locally with netbeans

Share your windows directory
Share the directory with something similar to your ubuntu folder like www

Mount the shared windows directory to yor apache web directory
 mount -t cifs //your-windows-ip/www -o username=win-user,password=win-password,noperm /var/www
Create the config file for apache redirect the url to the directory
In your linux go to the etc/apache2/sites-available directory and duplicate any of the configuration files or create a new file.

For example if you want to implement the domain call www.mydomain.loc you will need to create a file call www.mydomain.loc with the folowing content:

<VirtualHost *:80>
DocumentRoot "/var/www/mydomain"
ServerName mydomain.loc
ServerAlias www.mydomain.loc
<Directory "/var/www/mydomain">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

 

Create the apache symbolic link
You will need apache to anable the site (essentially tell apache to create a symbolic link in sites-enabled) you need to be on etc/apache2/sites-available:

a2ensite www.mydomain.loc
Check the config file was ok
/etc/init.d/apache2 reload

Reloading apche will tell you what it is wrong

Add the new domain to your windows environment
Open the windows hosts file with a text editor located at C:WindowsSystem32driversetchosts

Add your apache server ip with your domain in a new line:

1.1.1.1 www.mydomain.loc mydomain.loc

After you save the hosts file clean all the dns cache from your browsers in chrome you can type the following at the address bar:

chrome://net-internals/#dns

from the windows console you can do:

ipconfig /flushdns

Chrome play tricks some time for example the universal # comment some times dosn’t work and you will need ## or delete the line you don’t need

Now you can set up 2 different projects on netbeans one locally and other remote pointing to the same folder

Nice debugging….

 

About the author
Eduardo Silva was born in Buenos Aires, Argentina, and has being living in London for the past 15 years. With a background in psychology he is a IT developer and the co-founder of open-ecommerce.org, a digital content social enterprise. His passion is digital story-telling and has created short films and documentaries to help people promote there ideas.