国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > Wordpress > 正文

WordPress網(wǎng)站遷移過程詳解

2024-09-07 00:51:28
字體:
供稿:網(wǎng)友

前些日子我終于下定決心買 VPS,然后就把這個博客從虛擬主機(jī)上遷移過去,因?yàn)橛蛎蛔?只是換空間,所以大部分步驟是按 WordPress 提供的文檔操作,不過過程中碰上不少問題,最終且算是解決了,所以做一總結(jié).

備份舊服務(wù)器上的數(shù)據(jù)庫,舊的虛擬主機(jī)上提供有 cPanel 界面,所以操作十分簡單,備份舊服務(wù)器上的文件,同樣可以借助 cPanel。

導(dǎo)入舊數(shù)據(jù)庫到新服務(wù)器,因?yàn)?VPS 上沒有 cPanel,所以數(shù)據(jù)庫的導(dǎo)入是通過命令行執(zhí)行的.

首先通過 SSH 登錄到服務(wù)器,代碼如下:

ssh zfanw

然后執(zhí)行 MySQL 命令:

sam@Vevb.com:mysql -u mysqlusername -p databaseName < Vevb.com.bak.sql

導(dǎo)入的過程非常快,如果不確信是否成功,可以執(zhí)行 MySQL 命令查看:

use zfanwcom;

show tables;

結(jié)果如下:

  1. mysql> show tables; 
  2. +---------------------------+ 
  3. | Tables_in_zfanwcom | 
  4. +---------------------------+ 
  5. | wp_PopularPostsdata       | 
  6. | wp_commentmeta            | 
  7. | wp_comments               | 
  8. | wp_links                  | 
  9. | wp_options                | 
  10. | wp_postmeta               | 
  11. | wp_posts                  | 
  12. | wp_sucuri_lastlogins      | 
  13. | wp_term_relationships     | 
  14. | wp_term_taxonomy          | 
  15. | wp_terms                  | 
  16. | wp_usermeta               | 
  17. | wp_users                  | 
  18. +---------------------------+ 

復(fù)制舊文件到新服務(wù)器,數(shù)據(jù)庫導(dǎo)入完成后,將虛擬主機(jī)上備份的文件上傳到 VPS 并解壓到相應(yīng)目錄.

解析域名,將域名重新解析到新的 IP 上.

錯誤情況,解析完成后訪問新 IP 上的博客,就出現(xiàn)了各種情況.

先來看下 /etc/apache2/vhosts.d/ 目錄下 Vevb.com.conf 這個虛擬主機(jī)文件的配置:

  1. <VirtualHost *:80> 
  2.     ServerName Vevb.com 
  3.     ServerAlias m.survivalescaperooms.com 
  4.     ServerAdmin chenxsan@gmail.com 
  5.     DocumentRoot /srv/www/vhosts/Vevb.com 
  6.     <Directory "/srv/www/vhosts/Vevb.com"
  7.         AllowOverride All 
  8.         Options FollowSymLinks 
  9.         Order allow,deny 
  10.         Allow from all 
  11.     </Directory> 
  12. </VirtualHost> 

我碰到的情況中,有一種錯誤是這樣,代碼如下:

  1. Object not found! 
  2. 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. 
  3. If you think this is a server error, please contact the webmaster. 
  4. Error 404 
  5. m.survivalescaperooms.com 
  6. Apache/2.4.6 (Linux/SUSE) 

網(wǎng)上的資料有說是 .htaccess 文件的問題,因?yàn)槲易远x了 WordPress 的固定鏈接,但我的 .htaccess 文件內(nèi)容如下:

  1. # BEGIN WordPress 
  2. <IfModule mod_rewrite.c> 
  3. RewriteEngine On 
  4. RewriteBase / 
  5. RewriteRule ^index.php$ - [L] 
  6. RewriteCond %{REQUEST_FILENAME} !-f 
  7. RewriteCond %{REQUEST_FILENAME} !-d 
  8. RewriteRule . /index.php [L] 
  9. </IfModule> 
  10. END WordPress 

這是 WordPress 默認(rèn)的,另外,使用上一篇介紹的方法,可以看到我的服務(wù)器上已經(jīng)安裝了 mod_rewrite 模塊.

我的情況下,問題出在 /etc/apache2/httpd.conf 文件,WordPress 說明如下:

  1. 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 the .htaccess Context is allowed in .htaccess files. 

如果 Apache 的 httpd.conf (openSUSE 下安裝的 Apache 里配置文件是叫這個) 中 AllowOverride 被設(shè)置為 None,則 .htaccess 文件完全被忽視,所以我需要修改 httpd.conf 文件內(nèi)容,結(jié)果如下:

  1. <Directory /> 
  2.    Options FollowSymLinks 
  3.    AllowOverride All 
  4. </Directory> 

重啟 Apache 服務(wù)器:sudo rcapache2 restart

再度訪問博客,問題消失了,不過這篇是事后整理,碰上的許多枝末問題已經(jīng)遺忘,不一定完整.

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 楚雄市| 探索| 平远县| 斗六市| 汤阴县| 星子县| 华亭县| 慈溪市| 和平县| 双桥区| 衡水市| 吉安市| 道孚县| 青龙| 余干县| 鄢陵县| 丁青县| 白河县| 岑巩县| 苍山县| 松阳县| 云南省| 吐鲁番市| 老河口市| 磐安县| 尉犁县| 兰西县| 富裕县| 南宁市| 阆中市| 瑞金市| 信宜市| 民权县| 枞阳县| 长治县| 礼泉县| 新河县| 佛山市| 泸溪县| 宜君县| 乡宁县|