Windows – One localhost on two systems


I'm using Ubuntu and Windows 7 on the same computer,and have xampp installed on both and I want to have access to one local directory that is accessible to both Windows and Ubuntu. Is there any way to do it?

Best Answer

You can put the webservers' document root (the directory that is served by the webserver, 'htdocs') on the Windows NTFS filesystem. You can serve files from there in Windows and Linux (Ubuntu can mount NTFS filesystems).

The disk should be mounted when you browse to them from the Files application. Command-line you can follow the guide on the Ubuntu Documentation Center:

Find the partition using sudo blkid:

/dev/sda1: LABEL="Recovery" UUID="B23613F43613B875" TYPE="ntfs" 
/dev/sda2: LABEL="Windows" UUID="38CE9483CE943AD8" TYPE="ntfs" 
/dev/sda3: LABEL="Data" UUID="519CB82E5888AD0F" TYPE="ntfs" 
/dev/sda5: UUID="00d7d951-2a35-40fd-8e5d-411bb824ff3b" TYPE="swap" 
/dev/sda6: LABEL="Ubuntu" UUID="6044b1d0-208e-4ab3-850d-03a92e1516fc" TYPE="ext4" 

Create the mountpoint:

sudo mkdir /media/Data

Change the fstab file with sudo nano /etc/fstab and add the following line:

UUID=519CB82E5888AD0F  /media/Data  ntfs-3g  defaults,windows_names,locale=en_US.utf8  0 0

(Change values where necessary)

Then mount the filesystem with:

sudo mount /media/Data

You can then find the data on the Windows partition under /media/Data, so configure your Xampp configuration to serve files from there.