For various reasons, webmasters often need to migrate their websites, which may cause one or more problems. now I want to summarize my previous experiences and hope to help webmasters. The website space is divided into two types: independent and virtual. The following describes the migration methods of the two types of spaces. 1. migration of independent host websites refers to data migration. many webmasters often need to migrate websites for various reasons before migration, now I will summarize my previous experiences and hope to help you.
The website space is divided into two types: independent and virtual. The following describes the migration methods of the two types of spaces.
1. Independent host
Website Migration refers to data migration. The website must be closed no matter whether it is an independent or virtual host before migration. Data Migration is dividedDatabase dataAndPrograms and attachment filesTwo-part migration.
Database Migration: First stop MySQL on the old server. Copy the data files under the MySQL data storage directory. for the MySQL data storage directory, you can view the datadir parameters in the MySQL configuration file. (For Linux, the MySQL configuration file is usually/etc/my. cnf, and for Windows, it is the my. ini file under the root directory of the MySQL installation directory .)
Move the data file to the MySQL data storage directory corresponding to the new server. Note that for Linux, after moving the data file, change the corresponding file owner to your MySQL running account.
Migration of programs and attachments: move all files in the WEB Directory of your old server to the WEB Directory of the new server.
Modify the configuration file information:
1. Discuz! The X1.5 configuration file is in the config Directory, that is, the config. global. php and config. ucenter. php files.
2. the UCenter configuration file is in the data directory, that is, the config. inc. php file.
The database address, access user name, and password recorded in the configuration file must be modified based on the corresponding information of your new server. At the same time, if your domain name changes, you need to modify the corresponding domain name information in the configuration file.
3. because the background of the UCenter stores the configuration information of each application, after you modify the configuration file information, you need to go to the UCenter application management, correct the corresponding information (especially the IP address and domain name) to the correct address.
So far, the quick migration process for sites of independent host users has been described. The entire process is relatively simple. The only difference is the time consumed. of course, it depends on your site and transmission speed.
II. vm
The database data of the VM cannot be directly obtained by the webmaster. it is best to back up the database data through the website background, and then restore the database backup in the new space, however, the new space should be completely installed.
1. backup:
The data part of the website can be directly backed up in the UCenter background,
Log on to the UCenter background → Data Backup
In the UCenter, you can back up only the data of the UCenter, or the data of all applications or some applications. here we choose to back up the data of all applications. After submission, wait until the backup is complete. you can view it in the data backup record. Note that the full-site data backed up on the UCenter is stored in the UCenter and Discuz respectively! Each part of X: UCenter is in/uc_server/data/backup _ date_abcdef (ABCDEf is an example of backup data name); Discuz! X is in the root directory of the website/data/backup _ DATE _ ABCDEf (ABCDEF is an example of backup data name ). Many people's problems occur here. when uploading database backup files, be sure to place these two backup files in the correct location to avoid incomplete data loss and membership, posts and other data errors.
Compared with the virtual host, the backup program files should pay special attention to the UCenter and Discuz! X configuration files and profiles in the UCenter.
Back up all program files in the UCenter. pay attention to the data directory and the config. inc. php files must not be lost. the backup directory under the data Directory stores the data just backed up. the avatar Directory stores the avatar images of all members, so these files must not be lost.
Back up all program files in the forum. pay attention to the data/attachment directory and the config. global. php and config. ucenter. php files under the config directory, which must not be lost. If there is a template style, you also need to back up and download it separately. after the new space is installed, you can re-upload and enable it. Previously, the website had a DIY page. at this time, you need to export the backup, import the new space after it is installed.
It is also important to ensure that the database version and encoding of the migrated server are consistent with those of the original server. If encoding 1 is normal, garbled characters may occur.
2. install new programs and upload attachments and portraits
New installation Forum, Discuz during installation! X and UCenter database names and table name prefixes must be consistent with the original ones;
The program header, tail (if changed), and diy data must be overwritten again; the data downloaded to the local attachment, Avatar, and other data must be uploaded to the correct location of the new space; the pseudo-static rule file, template file, and Logo website Logo are re-uploaded to the correct location of the new space.
3. restore the database
First, log on to the UCenter background, check whether the communications between applications are successful, and then log on with the founder:
UCenter background → data backup record → data recovery → (find the corresponding Backup. if the backup does not exist, it indicates that the backup file is uploaded incorrectly !) Click Details> select backup data> Submit.
4. Subsequent operations
Because UCenter and Discuz! The URL path of X has changed to the correct path in the UCenter background.
UCenter Management backend → Application Management → Editing
Discuz! X url. Check the UCenter configuration information of the application. choose UCenter Management backend> Application Management> Edit Forum application. find the UCenter configuration information of the application and copy all the content, overwrite the UCenter configuration information at the end of the config file of the Forum. After the cache of the UCenter and Forum is updated, the website migration is basically done. for the remaining pseudo-static issues, make sure that the rewrite settings on the server are enabled.