Moving website in local XAMPP stack in a Mac... to Ubuntu 14.04 droplet

February 12, 2015 2.3k views

I have a website that I developed on a Mac using XAMPP (a cross-platform LAMP stack). The website uses the following technologies: HTML, CSS, Javascript, jQuery and PHP.

And I have a domain name I bought via

Now, I've bought a Digital Ocean droplet consisting of Ubuntu 12.04.

What are the steps I need to do to transfer my website so it becomes live on the domain? Could you kindly point me to up-to-date tutorials?

One key issue for me is that I will be hosting multiple domains on this droplet, so I might need to set up virtual hosts or use some other technique. Advice on how to do this would be especially welcome.

I've seen some tutorials on here, but some of the information seems a little old, so am not sure if it's up-to-date.

Thanks for the help.

5 Answers

This should be pretty straightforward. You did not mention that your website uses the MySQL/MariaDB server included in the XAMPP stack so I will not address that.

From a bare Ubuntu 12.04 server. First you will want to run updates (assuming you are logged in as root):

apt-get update;
apt-get upgrade;

Now we will need to install the Apache Web Server with PHP support

apt-get install apache2 php5

Once this is complete you will have a web server running on your droplet. Now we just need to transfer your files.

You can use Filezilla or any other SFTP client to connect to your droplet. Once connected you will start out in the /root directory while the default web root will be in /var/www so you'll want to change up a directory to reach the root of the disk and then navigate to /var/www and upload your files.

If your php scripts need to write any files to the disk you will want to make sure the ownership on your files is set to the same user the Apache process will use:

chown -Rf www-data:www-data /var/www

You should now be able to navigate to your droplet's IP address and view your site.

If you do need to transfer a MySQL database or you encounter any problems (such as missing php modules) let me know.

Thank you. Appreciate the quick answer.

A clarification please:

--- if I eventually plan to host multiple domains (small static websites) on the same droplet, what should I do now (and how) to prepare for that eventuality (e.g. set up virtualhosts or some other technique?).

  • By default apache defines a single virtualhost in /etc/apache2/sites-enabled. The methods I recommended make use of this virtualhost. You can later add additional name based virtual hosts by doing the following:

    First in the existing default virtualhost you will want to add a ServerName or ServerAlias directive with your domain name. If your domain were I would recommend the following:


    Then you can apply these changes by restarting apache:

    service apache2 restart

    To add another virtualhost you can copy the default virtualhost configuration file to create a new one:

    cp /etc/apache2/sites-enabled/000-default /etc/apache2/sites-enabled/

    And then update it to include a ServerName and ServerAlias directive with the new domain and to set the DocumentRoot path. Apache does not really care where your DocumentRoot is located as long as it has proper permissions (the chown command I mentioned earlier).

@ryanpq -- An update: everything in your first comment worked fine. Thank you very much.

I've asked about setting up multiple domains on my single droplet in my previous comment.

And I have one more request:
I have another site which has a MySQL database attached to it. I'd like your instructions on the correct way to install MySQL on the droplet, and then migrate the website with the MySQL database from from XAMPP on my Mac to the Ubuntu 14.04 droplet.


  • If you need to migrate a MySQL database as well you will first want to install the MySQL server and php modules for MySQL interaction:

    apt-get update;
    apt-get install mysql-server php5-mysql

    You should be prompted to create your MySQL root password during this process.

    Now, I believe your XAMPP installation includes PHPMyAdmin which will make exporting your database easy. In PHPMyAdmin, once you have navigated to your database there should be an export tab. Exporting using the default settings will give you a .sql file. Upload this file to your droplet. You can then import it with these steps:

    Log into the MySQL shell:

    mysql -u root -p;

    Then create a new empty database (using whatever name you like, usually the same name you used in XAMPP)

    create database mydatabase;

    And then you can read in your sql backup. This example assumes that the .sql file is located in /root

    use mydatabase;
    source /root/mydatabase.sql

Hi there. Serious issue I hope you could give me some advice on.

I deleted the default virtualhost in "sites-available". And created one named specifically for my site. After that, I moved some directories around, but now my site doesn't work any more. Specifically, the browser is able to access the Index page, but it isn't able to access a javascript file enclosed in a directory at the same level as the index page.

My public html files are in this folder:

index.html is here:

javascript is here:

I have done the following:
chown -R www-data:www-data /var/www
chmod -R 755 /var/www/

However, the browser is still unable to access the javascript file. Any suggestions on what's going on? (Browser is able to access the index file.)

Nevermind my last comment -- I was able to resolve it. For some reason my javascript file javascript/example.js wasn't able to be read by the browser. After I renamed the javascript directory js (so that the new path was js/example.js ) and updated my index file accordingly, everything started working.

Strange and bizarre, I know, but that's server admin for you!

Have another answer? Share your knowledge.