网站/WordPress从虚拟主机搬家到VPS上

拖了一个月终于着手并且完成了。其实没有什么难的。但是因为我对Linux的了解非常局限,还是花了一番功夫,同时学了很多东西,在这里记一下。没有试图写一篇“手把手教你搬WP”,只是记录一些我觉得有帮助的东西,希望做同样的事情的且同样不是那么牛逼的Linux学习者们有用:)

虽说是WordPress搬家,但是任何一个小型网站搬家都差不多这样了吧,嘿嘿。

如果用cPanel和MySQLAdmin之类的东西可能就很傻瓜,但是第一cPanel太贵了(竟然要425多刀一年,我都笑了),第二VPS都买了必须必须要抓住每一个学Linux的机会啊。

过程如下(断断续续弄了好几天…):

环境

虚拟主机和VPS都是host2ez的,最牛逼的主机提供商。系统是CentOS Linux 5.6,apache(现在改名叫httpd)已经装好了,再装

yum php mysql mysql-server

就成。

文件

这个简单,cPanel把虚拟主机上文件打包,VPS上wget下来就好。WP的独立性做的好,文件路径改变不会有什么问题。备份用的插件BackUpWordpress倒因为出问题了,不能识别路径,我直接禁用掉了,VPS嘛马上弄个备份方案还不容易,不需要用WP的插件了。在[wordpress path]/wp_config.php里把信息改一下,数据库部分的怎么改见下面。

数据库

对数据库命令不了解的同学建议先看一下mysql的教程。我不能把所有操作都写出来…这次弄这个还学了不少数据库的东西…tutorial很容易搜到,我觉得有一个比较好的命令列表点 这里,里面包括了所有常用的命令。

在虚拟主机的cPanel – mysqladmin里备份出.sql文件,传上VPS,导入文件的命令是

mysql – u user_name -p database_name < file_name.sql

很多地方写的-p后面跟密码,我用的版本-p后面不跟东西,回车以后才提示输密码,可能是新版本不提倡显式输入密码了吧。非要用的话就–password=”xxxxxx”

如果你导出文件选的是整个mysql,需要打开文件把database”information_schema”部分删掉,否则会失败,这个db貌似是mysql自己的,不能改..不懂

之后要建立一个用户并给此用户分配使用相应db的权限,虽然我们也可以直接把root用户写进wp_config.php但是稍微有点安全意识的程序员都不会想要这么做的…虽然权限没什么大不了的,但是名字叫root就是不行! 所以进数据库:

mysql -u root -p

进去以后添加用户:

mysql> create user 'username'@'localhost' identified by 'mypass';

分配权限:

mysql> grant all privileges on databasename.* to username@localhost;
mysql> flush privileges;

然后就把这个用户甩给Wordpress啦(编辑wp_config.php)

测试的时候有一些问题

上面完了就能http进vps的ip看到博客了,但是不要去点任何东西…因为数据库里“本站”的地址还是原来的域名,这样如果你原来的网站还开着那么随便点个链接就进到原来网站了,如果没开那就can’t find page啦。

而且因为没法进后台改,所以只好进mysql改了

mysql> use viaxlcom_viaxlcom;
mysql> select * from wp_options where option_value rlike "^http";
+-----------+---------+-------------+----------------------------+----------+
| option_id | blog_id | option_name | option_value               | autoload |
+-----------+---------+-------------+----------------------------+----------+
|         2 |       0 | siteurl     | http://axlarts.com/blog      | yes      |
|        39 |       0 | home        | http://axlarts.com           | yes      |
|        41 |       0 | ping_sites  | http://rpc.pingomatic.com/ | yes      | 
+-----------+---------+-------------+----------------------------+----------+
3 rows in set (0.06 sec)
update wp_options set option_value="http://12.34.56.78/blog" where option_id=2;
update wp_options set option_value="http://12.34.56.78" where option_id=39;

这样就把VPS上的网站地址改成本身的IP了。

————————————-
另外我发现一些插件会出现权限问题,比如JW player(放flv视频用的插件),没法启用插件因为提示不能写目录,我整个www目录都是755权限,设置成777以后可以开启了,然后再弄回来。这个问题解决了但是原因一直不知道,直到我因为另一个问题搜了一下才搞明白。

另一个问题是:更新插件update的时候会提示我输入ftp帐号,以前没这事啊,于是我就去装了个vsftpd(ftp的服务端),设置好能更新了,但是为什么?后来搜到这篇文章 <Auto Update WordPress Without FTP> 解决了ftp的问题并且意识到上面的问题也和这个有关系,即因为目录的owner不是httpd,所以网站脚本没有对文件操作的权限。

/var/www目录的owner要设置成httpd的运行者(可以用ps aux或者top命令查看),可能是www,apache或者nobody或者其他的。我的是apache,所以在chown apache:apache /var/www -R之后update就不用输ftp了,我立刻关了vsftpd依然ok,可见之前是绕了弯子了,没权限还用ftp操作文件…

绑域名

进godaddy面板直接改A地址就好了,没有别的要操作的。

但是因为我本来虚拟主机上就放了两个网站,所以怎么在一个VPS上绑定多个域名多个网站?之前用cPanel是傻瓜操作,没有怎么弄?这个我也弄了好半天最终解决了,马上再写一篇单独说吧

好啦好啦,到此结束,路人有问题可以在下面留言~

24,667 thoughts on “网站/WordPress从虚拟主机搬家到VPS上

  1. Narkolog na dom_lgPl

    Слушайте, какая история — человек в ступоре , а тащить в больницу нет никаких сил. Я сам через это прошел недавно совсем. Руки опускаются, время тикает. Лезешь в интернет, а вокруг одни обещания . Пока кто-то не подсказал один нормальный проверенный вариант. Требуется немедленная консультация — а везти самому нет физической возможности , то нужно вызывать врача на дом. Речь конкретно про наркологическую помощь на дому . В Самаре , к слову , тоже полно шарлатанов . Нормальные контакты, кто реально приезжает вот тут : вызвать врача нарколога на дом вызвать врача нарколога на дом Честно скажу , после того как вник в детали, понял, как правильно действовать. И про снятие запоя на дому, и про последующее кодирование. И цены адекватные, без разводов. Советую не тянуть .

    Reply
  2. 1xbet giris_ycOa

    Daha önce hiç böyle bir site görmemiştim. Açıkçası önyargılıydım biraz. Sonra biraz araştırayım dedim.

    Casino sevenler için biçilmiş kaftan. Detaylı incelemeleri tamamlayıp adımları takip ettikten sonra her şey netleşti. Giriş adresi işte karşınızda: 1xbet giriş 1xbet giriş. Kısacası durum ortada — 1xbet spor bahislerinin adresi burada.

    Hem hızlı hem güvenilir. Çok yere baktım emin olun — pişman eden bir yer değil kesinlikle. Hayırlı olsun…

    Reply
  3. Judedal

    Glad I stumbled across this post, the explanations actually make sense without needing background knowledge to follow along, and after a stop at createbettermomentum the same was true there, no assumptions about the reader just clear writing that anyone can understand from the first line right through to the end.

    Reply
  4. 1xbet giris_krKr

    Açıkçası ben de bu konuda epey araştırma yaptım. Herkes bir şey diyor ama kimse net konuşmuyor. Adımları doğru sırayla uyguladıktan sonra bağlantı hatasız açıldı. En sonunda güvenilir bir kaynak buldum ve size de aktarayım dedim: 1xbet spor bahislerinin adresi 1xbet spor bahislerinin adresi. Valla bak şimdi size şöyle söyleyeyim — bu işin ehli belli başlı yani.

    Hiçbir sorun yaşamadım bugüne kadar oynarken. Araştırmayı seven biriyimdir bu konuda — başka yerde aramaya gerek yok artık valla. Umarım işinize yarar bu bilgiler…

    Reply
  5. IanGuh

    Bookmarking this for later, the kind of resource I want to keep nearby, and a quick look at marblecovemerchantgallery confirmed the rest of the site is worth the same treatment, definitely going into my reference folder for the next time the topic comes up at work or in conversation with someone who asks.

    Reply
  6. Ignaciotem

    Started believing the writer knew the topic deeply by about the second paragraph, and a look at ebongreen reinforced that confidence, the speed at which a writer establishes credibility through their writing is a useful quality signal and this writer establishes it quickly and quietly without resorting to credential dropping or self promotion.

    Reply
  7. Narkolog na dom_ajPl

    Вот реально ситуация — близкий совсем плох, а везти в клинику нет никаких сил. Моя семья такое пережила недавно совсем. Сидишь, не знаешь за что хвататься . Начинаешь обзванивать знакомых , а вокруг сплошной развод . Пока случайно не нашел один реально работающий вариант. Требуется немедленная консультация — а ехать куда-то просто нереально, то выход один . Речь конкретно про круглосуточный вызов нарколога . В Самаре , если честно, хватает левых контор без лицензии. Вся проверенная информация вот тут : вызвать врача нарколога на дом вызвать врача нарколога на дом Честно скажу , после того как прочитал , понял, как правильно действовать. Там и про капельницы подробно , и про последующее кодирование. Плюс анонимность — это важно . Советую не откладывать.

    Reply
  8. Narkolog na dom_zgPl

    Вот реально ситуация — родственник в тяжелом запое , а тащить в больницу нет никаких сил. Моя семья такое пережила пару лет назад . Руки опускаются, время тикает. Начинаешь обзванивать знакомых , а вокруг только деньги тянут. Пока кто-то не подсказал один реально работающий вариант. Если нужна немедленная консультация — а ехать куда-то просто нереально, то выход один . Я про круглосуточный вызов нарколога . У нас в Самаре, если честно, тоже полно шарлатанов . Нормальные контакты, кто реально приезжает вот тут : вызвать нарколога на дом цены недорого https://narkolog-na-dom-samara-14.ru Честно скажу , после того как вник в детали, многое прояснилось . Там и про капельницы подробно , и про консультацию нарколога . Плюс анонимность — это важно . Рекомендую не тянуть .

    Reply
  9. Peterquode

    Liked how the post handled an objection I was forming as I read, and a stop at bravofarm similarly anticipated where my thinking was going next, the rare writer who can predict reader concerns and address them in advance is doing something most online content fails to do despite that being basic editorial work.

    Reply
  10. 1xbet giris_anpi

    Denemek isteyen herkese aynı şeyi söylüyorum. Sürekli engelleme derdi bitmek bilmiyor artık. Gerekli tüm teknik kontrolleri sırasıyla tamamlayıp süreci başlattım. En doğru adrese ulaştığımı düşünüyorum ve size de buradan bahsetmek istiyorum: 1xbet giriş 1xbet giriş. Valla bak şimdi size net söylüyorum — casino sevenler için ideal bir ortam var gerçekten.

    Hiçbir aksilik yaşamadım bugüne kadar. Kendi tecrübelerimi aktarıyorum size — kesinlikle pişman olmazsınız deneyin derim. Şimdiden bol şans yardımı ve iyi eğlenceler…

    Reply
  11. Emilianolap

    Reading carefully here has reminded me what reading carefully feels like, and a look at knackpact extended that reminder, the experience of careful reading versus skimming is different in ways I had partially forgotten and this site has clearly refreshed my memory of what attention feels like when content rewards it consistently.

    Reply
  12. Marioincom

    Halfway through I knew I would finish the post, and a stop at windharborartisanexchange also held me through to the end, content that signals its quality early and then sustains it is content with real internal consistency and this site has clearly figured out how to maintain quality from opening sentence through to closing thought.

    Reply
  13. PaxtonGlync

    Found the rhythm of the prose particularly enjoyable on this read through, and a look at growthwithprecision kept that musical quality going across the related pages, sentence rhythm is something most blog writers ignore but it makes a real difference in how content lands with the careful reader who cares.

    Reply
  14. Issacsor

    Definitely returning here, that is decided, and a look at grovequay only made the case stronger, this is one of those rare websites that rewards regular visits rather than feeling stale after the first read which is something I cannot say about most of the places I bookmark today across all my topics.

    Reply
  15. Mattquith

    A clean read with no irritations, and a look at mintdawn continued that frictionless quality, the absence of small irritations is something I notice only when present elsewhere and this site is one of the rare places where everything just works and lets me focus on the substance rather than fighting the format.

    Reply
  16. 1xbet giris_ljpi

    Aylardır araştırıyorum en sonunda buldum. İnanın herkes farklı bir adres veriyor kafayı yedim. Güncel detayları inceleyip sistemi test ettim ve sorunsuz çalıştı. En doğru adrese ulaştığımı düşünüyorum ve size de buradan bahsetmek istiyorum: 1xbet güncel 1xbet güncel. Şöyle düşünün yani — casino sevenler için ideal bir ortam var gerçekten.

    para çekme konusunda da sıkıntı görmedim açıkçası. İşin doğrusunu söylemek gerekirse — en çok güvendiğim adres burası oldu artık. Umarım siz de memnun kalırsınız…

    Reply
  17. Lawsonengen

    Closed the tab feeling I had spent the time well, and a stop at feltglen extended that feeling across more pages, the test of whether time on a site was well spent is one I apply silently after closing tabs and very few sites pass it but this one passed it cleanly today afternoon clearly.

    Reply
  18. Rolandoabess

    Glad the writer did not feel the need to argue with imaginary critics in the post itself, and a stop at freshguilds kept the same focused approach going, defensive writing wastes the reader time and confidence on positions that did not need defending and this post has clearly avoided that common failure.

    Reply
  19. Tristanhoupe

    A piece that did not waste any of its substance on sales or promotion, and a look at novalog continued that pure content focus, sites that resist the urge to monetise every paragraph are increasingly rare and this one has clearly made the editorial choice to keep the writing clean from commercial intrusion which I value highly.

    Reply
  20. BernardBow

    Really appreciate the lack of pop ups, modals, cookie banners stacking on top of each other, and a quick visit to createforwardplanning confirmed the same clean approach across the rest of the site, technical decisions about user experience are part of what makes content actually pleasant to engage with for sure.

    Reply
  21. 1xbet giris_bkOa

    Daha önce hiç böyle bir site görmemiştim. Açıkçası önyargılıydım biraz. Sonra şu linki görünce karar verdim.

    Spor bahislerinde iddialı olanlar buraya. Detaylı incelemeleri tamamlayıp adımları takip ettikten sonra her şey netleşti. Giriş adresi işte karşınızda: 1xbet güncel 1xbet güncel. Kısacası durum ortada — 1xbet güncel adres arayanlara duyurulur.

    Hiçbir sorun yaşatmadı şu ana kadar. Kendi adıma konuşuyorum — başka bir yere ihtiyacınız kalmaz. Hayırlı olsun…

    Reply
  22. Coreyvah

    Looking at the surface design and the substance together this site has both right, and a look at growththroughalignment reinforced that integrated quality, sites where presentation and content reinforce each other rather than fighting are sites with full editorial coherence and this one has clearly invested in both layers in a balanced way.

    Reply
  23. 1xbet giris_cypi

    Daha önce hiç bu kadar kararlı bir site görmedim. Sürekli engelleme derdi bitmek bilmiyor artık. Gerekli tüm teknik kontrolleri sırasıyla tamamlayıp süreci başlattım. En doğru adrese ulaştığımı düşünüyorum ve size de buradan bahsetmek istiyorum: 1xbet spor bahislerinin adresi 1xbet spor bahislerinin adresi. Valla bak şimdi size net söylüyorum — canlı bahis seçenekleri bile yeterli aslında.

    para çekme konusunda da sıkıntı görmedim açıkçası. Birçok platform denedim ama bunda karar kıldım — en çok güvendiğim adres burası oldu artık. Umarım siz de memnun kalırsınız…

    Reply
  24. 1xbet giris_vopi

    Aylardır araştırıyorum en sonunda buldum. Kapanan siteler yüzünden çok mağdur oldum. Gerekli tüm teknik kontrolleri sırasıyla tamamlayıp süreci başlattım. En doğru adrese ulaştığımı düşünüyorum ve size de buradan bahsetmek istiyorum: 1xbet güncel giriş 1xbet güncel giriş. Yani kısacası anlatmaya çalıştığım şu — casino sevenler için ideal bir ortam var gerçekten.

    bonus kampanyaları bile beklentimin üzerindeydi. Birçok platform denedim ama bunda karar kıldım — başka yerde kaybolmanıza gerek yok yani. Umarım siz de memnun kalırsınız…

    Reply
  25. Narkologicheskii stacionar_fbSl

    Слушайте, а вы в курсе, что найти нормальную клинику сейчас — это реально отдельная и очень сложная история. Многие лично сталкивались с такой ситуацией,, когда родным или близким людям срочно понадобилась грамотная помощь врачей. И тут сразу возникает главный вопрос: куда именно везти человека?

    Я сам недавно детально изучал этот вопрос, искал действительно надежный медицинский вариант. Очень сложно с ходу отличить реальные отзывы пациентов от банальной рекламы. Короче говоря, советую присмотреться к одному источнику, там подробно расписаны все важные условия и нюансы про анонимное снятие запоя в условиях клиники. В общем, не тяните время и долго не раздумывайте,, чтобы четко во всем разобраться.

    Вся актуальная информация и контакты доступны прямо здесь: наркология вывод из запоя в стационаре наркология вывод из запоя в стационаре. Сам сначала даже не думал, насколько там много подводных камней, на которые стоит обращать внимание, и главное — там работают доктора, которые реально спасают людей. Для Санкт-Петербурга это точно один из самых лучших вариантов, так что рекомендую сохранить себе в закладки на всякий случай.

    Reply
  26. 1xbet giris_waKr

    Şu bahis işlerine merak salalı çok oldu. Herkes bir şey diyor ama kimse net konuşmuyor. Adımları doğru sırayla uyguladıktan sonra bağlantı hatasız açıldı. En sonunda güvenilir bir kaynak buldum ve size de aktarayım dedim: 1xbet güncel 1xbet güncel. Ne diyeyim yani anlatayım mı — bahis olsun casino olsun her şey düşünülmüş resmen.

    bonusları bile tatmin edici gerçekten inanın. Kendi adıma konuşuyorum size açık açık — en memnun kaldığım yer burası oldu kesinlikle. Şimdiden iyi eğlenceler dilerim hepinize…

    Reply
  27. IanGuh

    Learned something from this without having to dig through layers of fluff, and a stop at marblecovemerchantgallery added a bit more context that helped tie things together for me, definitely a useful corner of the internet for anyone who wants real information without the usual marketing nonsense around it that often ruins similar pages.

    Reply
  28. Emilianolap

    Reading carefully here has reminded me what reading carefully feels like, and a look at knackpact extended that reminder, the experience of careful reading versus skimming is different in ways I had partially forgotten and this site has clearly refreshed my memory of what attention feels like when content rewards it consistently.

    Reply
  29. BarneyalUmp

    Pleasant surprise, the post delivered more than the headline promised, and a stop at amberharborcraftcollective continued that pattern of under promising and over delivering, the rarest combination on the modern web where most content does the opposite by promising the world and delivering thin recycled summaries instead each time you click on something interesting.

    Reply
  30. Normanwravy

    Started this morning and finished at lunch with a small sense of having spent the time well, and a look at findyournextstrategicmove extended that satisfaction into the afternoon, content that fits naturally into the rhythm of a working day rather than demanding a dedicated reading block is increasingly the kind I prefer.

    Reply
  31. Marioincom

    Worth pointing out the careful word choice in this post, no buzzwords and no jargon, and a look at windharborartisanexchange continued that disciplined vocabulary, sites that resist the pull of trendy language are sites that will read well in five years and this one is clearly built for that kind of long durability.

    Reply
  32. 1xbet giris_gmKr

    Şu bahis işlerine merak salalı çok oldu. Herkes bir şey diyor ama kimse net konuşmuyor. Detaylı güncellemeleri kontrol edip süreci sorunsuz başlattım. En sonunda güvenilir bir kaynak buldum ve size de aktarayım dedim: 1xbet spor bahislerinin adresi 1xbet spor bahislerinin adresi. Ne diyeyim yani anlatayım mı — bahis olsun casino olsun her şey düşünülmüş resmen.

    çekimler konusunda da sıkıntı yok yani rahat olun. Kendi adıma konuşuyorum size açık açık — en memnun kaldığım yer burası oldu kesinlikle. Umarım işinize yarar bu bilgiler…

    Reply
  33. Rolandoabess

    Approaching this site through a casual link click and being surprised by what I found, and a look at freshguilds extended the surprise, the rare experience of stumbling into excellent independent content rather than predictable mediocrity is one of the actual remaining pleasures of casual web browsing and this site provided it cleanly.

    Reply
  34. SeanTal

    A piece that suggested careful editing without showing the marks of the editing, and a look at startmovingwithclarity continued that invisible polish, the best editing disappears into the prose and this site reads as having been edited with skill that does not announce itself which is the highest compliment I can offer any blog content.

    Reply
  35. Narkologicheskii stacionar_kbSl

    Знаете, поиск действительно проверенного медицинского центра — это всегда целая проблема и головная боль. Многие лично сталкивались с такой ситуацией,, когда кому-то из членов семьи срочно понадобилась грамотная помощь врачей. И в этот момент обычно начинается паника просто из-за банальной нехватки информации.

    Я сам недавно детально изучал этот вопрос, искал действительно надежный медицинский вариант. В интернете сейчас столько мусора и дорвеев, что голова идет кругом. Если коротко, лучше сразу перейти на официальный сайт, где нет вранья, там подробно расписаны все важные условия и нюансы про анонимное снятие запоя в условиях клиники. В такой ситуации лучше один раз внимательно глянуть самостоятельно, чтобы четко во всем разобраться.

    Вся актуальная информация и контакты доступны прямо здесь: выведение алкоголизма стационар выведение алкоголизма стационар. Честно говоря, после изучения всех условий, насколько там много подводных камней, на которые стоит обращать внимание, и главное — там работают доктора, которые реально спасают людей. Для Санкт-Петербурга это точно один из самых лучших вариантов, так что рекомендую сохранить себе в закладки на всякий случай.

    Reply
  36. MikeElurn

    Generally I find the content on similar topics frustrating in specific ways and this post avoided all of them, and a look at exploreuntappeddirectionideas continued that frustration free experience, content that sidesteps the standard failure modes of its genre is content with editorial awareness and this site has clearly studied what fails elsewhere consistently.

    Reply
  37. Hugowom

    Probably this is one of the better quiet successes on the open web at the moment, and a look at edgedial reinforced that quiet success quality, sites that are doing well without making a noise about doing well are the sites I most respect and this one has clearly chosen the quiet success path consistently throughout.

    Reply
  38. Tristanhoupe

    Decided to set a calendar reminder to revisit, and a stop at novalog extended that revisit list, calendar entries for content are a level of commitment I rarely make but when I do they signal a higher regard than a simple bookmark and this site has earned that calendar tier of relationship from me today.

    Reply
  39. Narkolog na dom_lvon

    Знаете, ситуация бывает — родственник в запое , а тащить в клинику страшно . Моя семья такое пережила недавно. Сидишь, не знаешь что делать . Начинаешь обзванивать знакомых , а вокруг сплошной развод . Пока случайно не наткнулся на один реально работающий вариант. Если нужна немедленная консультация — а везти самому нет возможности , то нужно вызывать врача на дом. Речь конкретно про круглосуточный выезд нарколога. В Самаре , к слову , тоже полно шарлатанов . Нормальные контакты, кто реально приезжает ниже по ссылке: нарколог на дом частная скорая помощь https://narkolog-na-dom-samara-13.ru Честно скажу , после того как вник в детали, многое прояснилось . И про снятие запоя на дому, и про консультацию . И цены адекватные, без разводов. Советую не откладывать.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *