IT/Procedures/Website Moving: Difference between revisions

From msgwiki
< IT‎ | Procedures
Jump to navigation Jump to search
Access restrictions were established for this page. If you see this message, you have no access to this page.
(added file moving)
(added vhost)
Line 49: Line 49:
=== Vhost file ===
=== Vhost file ===


vhost
One has to make changes to the two Vhost files wordpress.conf and wordpressSSL.conf. In wordpress.conf the only thing one has to do is to add the following "paragraph" to the file (if possible by copying from an existing entry of another website and changing the differences):
 
<nowiki>
<VirtualHost *:80>
  ServerName moodle.msgcgk.com
  ServerAlias www.moodle.msgcgk.com
  ServerAdmin it@moodle.msgcgk.com
  DocumentRoot /var/www/html/moodle.msgcgk/
    <Directory />
        Options Indexes FollowSymLinks MultiViews
            AllowOverride All
        Order allow,deny
            allow from all
    </Directory>
 
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.moodle.msgcgk.com [OR]
RewriteCond %{SERVER_NAME} =moodle.msgcgk.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
</nowiki>

Revision as of 11:33, 24 September 2021

Moving a website from one server to another takes several steps which are listed here.

Zoneedit

Since the website will be moved from one server to another and these two servers do not have the same IP address, one has to change the IP address to which the domain name points to.

In Zoneedit this is done as follows:

  1. Go to Domains.
  2. Look for the websites domain in the list and click on 'dns'.
  3. Look for A Records and click 'edit'.
  4. Add the websites (sub)domain and/or point it to the IP address of the new server.
  5. Click 'next'.
  6. The changes will be shown. Click 'confirm'.
  7. Click done.

Database

In order for the website to run it needs its database. To move the database from the old server to the new one, use the following command on the old server (O:old server; N:new server):

mysqldump -v -uDBUSERO -pDBPASSWORDO DATABASENAMEO | ssh USERN@ADDRESSN mysql -uDBUSERN -pDBPASSWORDN DATABASENAMEN

Files

The files for the website have to be moved as well, which takes several steps. First of all, one has to create a new directory into which the files will be moved. This directory should normally be in /var/www/html/. To create this new directory use the command on the :

sudo mkdir FOLDERNAME

To avoid permission problems, change the ownership of this directory to the user of the new server using the command:

sudo chown USER:USER FOLDERNAME

To move the files use the following comand on the old server:

sudo rsync -av --progress -e ssh /var/www/html/FOLDERNAMEO/ USERN@ADDRESSN:/var/www/html/FOLDERNAMEN

Make sure that all the permissions and the ownership is set up correctly by using three commands on the new server as follows:

change the permissions for directories:

find FOLDERNAME/ -type d -exec chmod 755 {} \;

change the permissions for files:

find FOLDERNAME/ -type f -exec chmod 644 {} \;

change ownership:

sudo chown www-data:www-data -R FOLDERNAME

Vhost file

One has to make changes to the two Vhost files wordpress.conf and wordpressSSL.conf. In wordpress.conf the only thing one has to do is to add the following "paragraph" to the file (if possible by copying from an existing entry of another website and changing the differences):

<VirtualHost *:80> ServerName moodle.msgcgk.com ServerAlias www.moodle.msgcgk.com ServerAdmin it@moodle.msgcgk.com DocumentRoot /var/www/html/moodle.msgcgk/ <Directory /> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> RewriteEngine on RewriteCond %{SERVER_NAME} =www.moodle.msgcgk.com [OR] RewriteCond %{SERVER_NAME} =moodle.msgcgk.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost>