How To Set Up Apache Virtual Hosts, PHP, MYSQL, and Magento 2 on Ubuntu 14.04? Part 1/2

Video ready, click here to close ×


How To Set Up Apache Virtual Hosts, PHP, MYSQL, and Magento 2 on Ubuntu 14.04? Part 1/2

sudo apt-get update
sudo apt-get install apache2

1. Create the Directory Structure

sudo mkdir -p /var/www/paulfan.net/public_html
sudo mkdir -p /var/www/elliex.com/public_html

2. Grant Permissions

sudo chown -R $USER:$USER /var/www/paulfan.net/public_html
sudo chown -R $USER:$USER /var/www/elliex.com/public_html
sudo chmod -R 755 /var/www

3. Create Demo Pages for Each Virtual Host

nano /var/www/paulfan.net/public_html/index.html

enter these:

…. you can create a sample webpage for testing using html.

copy the setting to the 2nd site:

cp /var/www/paulfan.net/public_html/index.html /var/www/elliex.com/public_html/index.html

nano /var/www/elliex.com/public_html/index.html

…. you can create a sample webpage for testing using html.

4. Create New Virtual Host Files

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/paulfan.net.conf
sudo nano /etc/apache2/sites-available/paulfan.net.conf

change the following item:
ServerAdmin admin@paulfan.net
ServerName paulfan.net
ServerAlias www.paulfan.net
DocumentRoot /var/www/paulfan.net/public_html

In total, our virtualhost file should look like this:

Inside teh VirtualHost *:80 brackets

ServerAdmin admin@paulfan.net
ServerName paulfan.net
ServerAlias www.paulfan.net
DocumentRoot /var/www/paulfan.net/public_html

Do the 2nd domain:

sudo cp /etc/apache2/sites-available/paulfan.net.conf /etc/apache2/sites-available/elliex.com.conf
sudo nano /etc/apache2/sites-available/elliex.com.conf

5. Enable the New APACHE2 Virtual Host Files

sudo a2ensite paulfan.net.conf
sudo a2ensite elliex.com.conf

sudo service apache2 restart

6. Set Up Local Hosts File

sudo nano /etc/hosts

127.0.0.1 localhost
127.0.1.1 guest-desktop
123.123.123.123 paulfan.net
123.123.123.123 elliex.com

Now if you type www.paulfan.net, it should see

Welcome to paulfan.net!
Success! The…

source

Leave a Reply

Your email address will not be published. Required fields are marked *