麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > CMS > Wordpress > 正文

WordPress網站遷移過程詳解

2024-09-07 00:51:28
字體:
來源:轉載
供稿:網友

前些日子我終于下定決心買 VPS,然后就把這個博客從虛擬主機上遷移過去,因為域名不變,只是換空間,所以大部分步驟是按 WordPress 提供的文檔操作,不過過程中碰上不少問題,最終且算是解決了,所以做一總結.

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

導入舊數據庫到新服務器,因為 VPS 上沒有 cPanel,所以數據庫的導入是通過命令行執行的.

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

ssh zfanw

然后執行 MySQL 命令:

[email protected]:mysql -u mysqlusername -p databaseName < Vevb.com.bak.sql

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

use zfanwcom;

show tables;

結果如下:

  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. +---------------------------+ 

復制舊文件到新服務器,數據庫導入完成后,將虛擬主機上備份的文件上傳到 VPS 并解壓到相應目錄.

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

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

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

  1. <VirtualHost *:80> 
  2.     ServerName Vevb.com 
  3.     ServerAlias www.companysz.com 
  4.     ServerAdmin [email protected] 
  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. www.companysz.com 
  6. Apache/2.4.6 (Linux/SUSE) 

網上的資料有說是 .htaccess 文件的問題,因為我自定義了 WordPress 的固定鏈接,但我的 .htaccess 文件內容如下:

  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 默認的,另外,使用上一篇介紹的方法,可以看到我的服務器上已經安裝了 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 被設置為 None,則 .htaccess 文件完全被忽視,所以我需要修改 httpd.conf 文件內容,結果如下:

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

重啟 Apache 服務器:sudo rcapache2 restart

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 色97色| 人人做人人看 | 97久久精品一区二区三区观看 | 99亚洲视频 | 成年人在线视频 | 色网在线视频 | 日日操夜 | 宅男视频在线观看免费 | 国产美女白浆 | 国产精品亚洲综合 | 久久亚洲精品久久国产一区二区 | a黄在线观看| 九九热精品视频在线 | 美女久久久久 | 毛片免| 国产精品av久久久久久久久久 | www69xxxxx| 欧美天堂一区 | 97超级碰碰人国产在线观看 | 羞羞草视频 | 免费a级网站 | 视频一区二区三区在线播放 | 欧美成网 | 5a级毛片| 一级看片免费视频 | 九九精品在线观看 | 欧美 videos粗暴| av老司机久久 | 久久久综合 | 九九热在线视频观看 | 一级毛片在线观看视频 | 国产99久久久国产精品 | 一区二区三区欧美在线 | 亚洲综合中文 | 亚洲成人在线免费观看 | 黄色特级一级片 | 91福利影视 | 午夜视频久久 | 久久久国产精品网站 | 视频h在线 | 亚州精品天堂中文字幕 |