Back up the database on the old server #
The cPanel interface is provided on the old VM, so the operation is very simple.
Back up files on the old server #
You can also use cPanel.
Import the old database to the new server #
Because cPanel is not available on VPS, database import is performed through command lines.
First, log on to the server through SSH:
The code is as follows: |
Copy code |
Ssh zfanw Then run the MySQL command: The sam@111cn.net: mysql-u mysqlusername-p databaseName <111cn.net. bak. SQL The import process is very fast. If you are not sure whether the import is successful, you can run the MySQL command to view the result: Use zfanwcom; Show tables; The result is as follows: Mysql> show tables; + --------------------------- + | Tables_in_zfanwcom | + --------------------------- + | Wp_PopularPostsdata | | Wp_commentmeta | | Wp_comments | | Wp_links | | Wp_options | | Wp_postmeta | | Wp_posts | | Wp_sucuri_lastlogins | | Wp_term_relationships | | Wp_term_taxonomy | | Wp_terms | | Wp_usermeta | | Wp_users | + --------------------------- +
|
Copy the old file to the new server #
After the database is imported, upload the backup files on the VM to VPS and decompress the files to the corresponding directory.
Resolved domain name #
Resolve the domain name to a new IP address.
Error #
After the resolution, you can access the blog on the new IP address.
Let's take a look at the configuration of the virtual host file 111cn.net. conf in the/etc/apache2/vhosts. d/directory:
The code is as follows: |
Copy code |
<VirtualHost *: 80> ServerName 111cn.net ServerAlias www.111cn.net ServerAdmin chenxsan@gmail.com DocumentRoot/srv/www/vhosts/111cn.net <Directory "/srv/www/vhosts/111cn.net"> AllowOverride All Options FollowSymLinks Order allow, deny Allow from all </Directory> </VirtualHost> |
One of the errors I encountered was:
The code is as follows: |
Copy code |
Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404 Www.111cn.net Apache/2.4.6 (Linux/SUSE)
|
Some materials on the Internet say that the. htaccess file is a problem because I have customized a fixed link for WordPress. However, the content of my. htaccess file is as follows:
The code is as follows: |
Copy code |
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase/ RewriteRule ^ index. php $-[L] RewriteCond % {REQUEST_FILENAME }! -F RewriteCond % {REQUEST_FILENAME }! -D RewriteRule./index. php [L] </IfModule> # END WordPress
|
This is the default WordPress. In addition, using the method described in the previous article, we can see that the mod_rewrite module has been installed on my server.
In my case, the problem occurs in the/etc/apache2/httpd. conf file. The WordPress description is as follows:
Your server may not have the AllowOverride directive enabled. if the AllowOverride directive is set to None in your Apache httpd. config file, then. htaccess files are completely ignored. in this case, the server will not even attempt to read. htaccess files in the filesystem. when this directive is set to All, then any directive which has. htaccess Context is allowed in. htaccess files.
If Apache httpd. in conf (the configuration file in Apache installed in openSUSE is called this), AllowOverride is set to None. the htaccess file is completely ignored, so I need to modify httpd. conf file. The result is as follows:
The code is as follows: |
Copy code |
<Directory/> Options FollowSymLinks AllowOverride All </Directory>
|
Restart the Apache server:
Sudo rcapache2 restart
Accessing the blog again disappears.
However, this article is post-event sorting. Many of the branch issues have been forgotten and are not necessarily complete.