0

I need some help with this site that I'm currently working on.

So I have multiple database given to me and my task is to migrate it to a host name that I'm given.

Ubuntu 18.04
PHPMYADMIN 
MySql
PHP 
Apache2 

My work:

I create a simple database with username, password and DB name. I created a new site-available .conf file and entered all the details (changed the port and servername to hostName).I then went to PhpmyAdmin and clicked on the newly created database and pressed import. I then imported the database that was given to me. To check If I have the site up, i went to the new host name but All i saw was a default Apache2 page and not the actually site.

From what I know, i think I have to make some configuration changes through Ubuntu Terminal. But I'm not exactly sure how to Migrate it.

So to conclude, I'm given a database and I need to use that database and when I type the hostname, it should have the site running.

Please help.

Update:

I made a directory: /var/www/html/name/wordpress unzipped it

mysql- u root -p

created the database (db,username,pass)

cd /var/www/html/name/wordpress/
sudo nano wp-config.php

entered all the info exit;

phpMyAdmin

select the newly created database --> import --> used the given database


cd /etc/apache2/sites-available 
sudo nano site1.conf

entered the following:

<VirtualHost *:80>
   ServerAdmin admin@**NEWHOSTNAME_THAT I WAS GIVEN**
   ServerName NEWHOSTNAME_THAT I WAS GIVEN
   ServerAlias NEWHOSTNAME_THAT I WAS GIVEN
   DocumentRoot /var/www/html/name/wordpress/
   <Directory /var/www/html/name/wordpress>
        Options FollowSymLinks
        Allowoverride None
   </Directory>
   <Directory /var/www/html/name/wordpress>
        Options Indexes FollowSymLinks MultiViews
        Allowoverride None
        Order allow,deny
        allow from all
   </Directory>
</VirtualHost>

Googled: the host name that i was given and in result i get a default apache2 page.

apache2ctl -S

Virtual Host Configuration: 
*:80 is a NameVirtualHost

default server (hostname_given) (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost (hostname_given)(/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost (hostname_given)(/etc/apache2/sites-enabled/000-default.conf:1)
     alias (hostname_given)
port 80 namevhost (hostname_given)(/etc/apache2/sites-enabled/000-default.conf:1)
     alias (hostname_given)
  • You need some client that will read/write the data from/to the database. For example maybe some CMS as WordPress, etc... if there is some please share this information :) Also the content of /etc/apache2/sites-available/your.conf will be worth. And do not forget to sudo a2ensite your.conf && sudo systemctl reload apache2.service. – pa4080 Mar 15 '19 at 15:59
  • okay so I'll make a simple wordpress site. Make a new .conf file and inside change the port/serverName to the one that I have and reload the apache service correct? – Jainam Patel Mar 15 '19 at 16:04
  • Yes you must install and configure a new WordPress instance and after that use the existing data base - here is a short guide: https://askubuntu.com/a/941947/566421. The other way is to copy the previous WordPress installation and .conf file on their places in the new server. – pa4080 Mar 15 '19 at 16:07
  • In addition keep in mind if the new host name is different from the old one, you should find and change it within the database... otherwise WordPress will not work. – pa4080 Mar 15 '19 at 16:09
  • hey I got the wordpress site ready but when I enter the new hostname in the url menu, it still shows me the default apache2 page. Please help – Jainam Patel Mar 15 '19 at 16:50
  • Have you restart or reload Apache - sudo systemctl estart apache2.service? If everything is okay on the server side probably you need to flush your browser's cache. On Chrome/Chromium you can use Ctrl+Shift+R. – pa4080 Mar 15 '19 at 17:29
  • hey @pa4080 please check the updated description. – Jainam Patel Mar 15 '19 at 17:51
  • Why are you using port 22 in your Virtual Host config? – DaveStSomeWhere Mar 15 '19 at 18:08
  • I changed it to port 80, it still displays the default page. – Jainam Patel Mar 15 '19 at 18:10
  • You need to enable the new configuration file: sudo a2ensite site1 && sudo systemctl reload apache2.service – pa4080 Mar 15 '19 at 18:20
  • I've enabled it and reloaded already. Still nothing. – Jainam Patel Mar 15 '19 at 18:22
  • Does the default site need to be disabled? What is your output from apache2ctl -S – DaveStSomeWhere Mar 15 '19 at 18:32
  • @DaveStSomeWhere check the updated description. – Jainam Patel Mar 15 '19 at 19:04

0 Answers0