网站/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是傻瓜操作,没有怎么弄?这个我也弄了好半天最终解决了,马上再写一篇单独说吧

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

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

  1. GeoffreyskiRe

    Started forming counter examples to test the claims and the post handled most of them implicitly, and a look at seohive continued that anticipatory style, writers who think two steps ahead of the critical reader save themselves from a lot of follow up work and this writer has clearly internalised that habit consistently.

    Reply
  2. AngelJum

    Reading this gave me a quiet moment of intellectual pleasure that I had not been expecting, and a stop at isebulb extended that pleasure across more pages, the unexpected reward of stumbling into careful writing is one of the small ongoing pleasures of reading the open web and this site is delivering it reliably.

    Reply
  3. Rickgen

    Once I trust a site this much I tend to read everything they publish and that is the trajectory I am on with this one, and a stop at unlockcreativepaths confirmed the trajectory, the rare progression from interested reader to comprehensive reader is something only certain sites earn and this one is earning that progression rapidly.

    Reply
  4. Colindrops

    Good quality through and through, no rough edges and no signs of being rushed, and a quick look at learnandexecuteclearly kept the same polish going, the kind of site that respects its own brand by maintaining consistency across pages which is something I always appreciate as a reader looking for trustworthy information online today.

    Reply
  5. Chadhip

    A relief to read something where I did not have to fact check every claim mentally, and a look at discoverforwardmomentumnow continued that reliable feeling, sites where I can lower my guard and trust the content are rare and this one is earning that trust paragraph by paragraph through consistent careful work behind the scenes.

    Reply
  6. Aidantrumb

    More substantial than most of what I find searching for this topic online, and a stop at createbetterpaths kept that quality consistent, this is one of those sites where the writing actually rewards careful reading rather than punishing the patient reader with empty filler stretched out across long paragraphs that say very little.

    Reply
  7. KeithAlalo

    Polished and informative without feeling overproduced, that is the sweet spot, and a look at discovernewfocus hit it again, you can tell when a site has been built with care versus thrown together for the sake of having something to put online and this is clearly the former approach taken by the team.

    Reply
  8. JulianNic

    Came here from a search and stayed for the side links because they were that interesting, and a stop at buildyournextstrategy took me even further into the site, the kind of organic exploration that good content invites is something most sites kill through aggressive interlinking and pushy navigation choices rather than relying on quality.

    Reply
  9. melbet_clSa

    Народ, если кто искал, толковый разбор. Нашел чистый вариант, в итоге скачал отсюда: melbet.

    Кстати, площадка реально топовый — все интуитивно понятно даже новичку. Там еще можно ставить прямо в режиме реального времени.

    Там сейчас можно неплохо увеличить первый депозит, что очень даже кстати. Всем удачи!

    Reply
  10. Kak_yukl

    Чтобы быстро и эффективно узнать местонахождение по номеру телефона, воспользуйтесь платформами которые не врут.
    Знаете, многие лезут в дебри, а зря.
    Следует учитывать, что некоторые платформы платные и их подлинность надо проверять.
    Надеюсь, понятно объяснил.

    Reply
  11. Rileyzew

    Now noticing that the post avoided the temptation to be funny in places where humour would have undermined the substance, and a stop at learnandapplywisely maintained the same restraint, knowing when to be serious is a rare editorial virtue and this site has clearly developed it through what I assume is careful editorial practice over years.

    Reply
  12. Horacebucky

    Useful enough to recommend to several people I know who would appreciate it, and a stop at mintdawns added more material I will pass along too, the kind of writing that earns word of mouth is the kind that actually delivers on its promises which is what this site does without any drama or fanfare attached.

    Reply
  13. 1xbet_bwOi

    Güvenli bahis deneyimi için 1xbet yeni giriş adresini kullanabilirsiniz.
    son derece hızlı ve pratik. Üyelik ve giriş süreci hızlıca tamamlanabilir. Kullanıcılar giriş yapmak için doğru siteyi seçmelidir. Site güvenliğine verilen önem yüksektir.

    Kullanıcılar giriş yapmak için ana sayfadaki giriş linkini kullanmalıdır. Doğru kullanıcı adı ve şifre girilmesi çok önemlidir. Her zaman resmi site olduğundan emin olunması gerekir.

    Eğer henüz üye değilseniz, basit bir formla kayıt olunabilir. Bilgilerin eksiksiz ve doğru doldurulması önem taşır. Bazı durumlarda hesabınızı onaylemek için ek adımlar uygulanabilir.

    Siteye giriş sonrası birçok seçenek sizleri bekler. Spor bahisleri ve canlı oyunlar kolaylıkla oynanabilir. Kampanyalar hakkında bilgi alabilir ve fırsatları yakalayabilirsiniz.

    Reply
  14. JamesSmoge

    Worth every minute of the time spent reading, and a stop at startbuildingclearvision extends that value across more pages, in a media environment where most content is engineered to waste attention this site stands out by treating reader time as something valuable rather than something to be exploited and stretched as far as possible.

    Reply
  15. Devinename

    The post made the topic feel approachable without making it feel trivial, that is a fine balance, and a stop at learnandaccelerategrowthpath maintained the same balance, finding the middle ground between welcoming and serious is genuinely difficult and the writers here have clearly figured out how to consistently hit it well across many different posts.

    Reply
  16. Noelhah

    Stands out for actually being useful instead of just being long, and a look at discovercreativegrowth kept that going, length without value is the default mode of most blogs these days but this site has clearly chosen a different path which I respect a lot as a reader who values careful editing decisions like that.

    Reply
  17. melbet_viSa

    Для тех, кто в теме, свежая инфа. Сам долго ковырялся, делюсь полезной ссылкой: melbet скачать на андроид.

    Кстати, площадка реально топовый — коэффициенты вполне адекватные. К тому же можно ставить прямо в режиме реального времени.

    Для новых пользователей активируется стартовый фрибет, лишним точно не будет. Кто уже ставил там?

    Reply
  18. AngelJum

    Reading this gave me a quiet moment of intellectual pleasure that I had not been expecting, and a stop at isebulb extended that pleasure across more pages, the unexpected reward of stumbling into careful writing is one of the small ongoing pleasures of reading the open web and this site is delivering it reliably.

    Reply
  19. JulianNic

    Once I had read three posts the editorial pattern was clear, and a look at buildyournextstrategy confirmed the pattern from a fourth angle, sites where the underlying approach reveals itself through accumulated reading rather than being announced are sites with real depth and this one has that quality clearly visible across multiple pieces consistently.

    Reply
  20. Melvinlog

    Now understanding why someone recommended this site to me a while back, and a stop at findyournextbreakpoint explained the recommendation, sometimes recommendations make sense only after experience and this site has finally clicked into place as the kind of resource I now understand was being recommended for sound editorial reasons by my friend.

    Reply
  21. shkola_rlon

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

    Reply
  22. shkola_tzon

    Я изначально скептически относился ко всей этой дистанционке. Думал, сын просто будет играть в танчики. Но жена настояла, нашли один портал с живыми учителями: онлайн обучение для детей . Пришлось признать, что был не прав. Успеваемость подтянулась, особенно по точным наукам. Объясняют на пальцах, без лишней воды. Плюс огромный – никаких больничных, заболел – смотришь записи. Для современных детей самое то, ИМХО.

    Reply
  23. vivod iz zapoya v stacionare_jisr

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

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

    Врачи дежурят круглосуточно во всех районах, и помощь окажут полностью конфиденциально. Главное — не затягивать в такие моменты, и обращайтесь к настоящим профессионалам. Всем удачи и берегите близких!

    Reply
  24. 1xbet_enOi

    Güvenli bahis deneyimi için 1xbet spor bahislerinin adresi adresini kullanabilirsiniz.
    1xbet platformuna giriş işlemi. Bu siteye erişim için birkaç adım yeterlidir. Öncelikle resmi web sitesi ziyaret edilmelidir. Site güvenliğine verilen önem yüksektir.

    Giriş sayfasına yönlendirme için ana sayfadan ilgili buton seçilmeli. Hatalı bilgi girişinde erişim sağlanamaz. Sahte sitelere karşı dikkatli olunması önerilir.

    Üyeliğiniz yoksa, kayıt işlemi birkaç dakika içinde tamamlanabilir. Doğru bilgilerin girilmesi kayıt sonrası işlemleri kolaylaştırır. Doğrulama aşamasında telefon veya e-posta onayı gerekebilir.

    Siteye giriş sonrası birçok seçenek sizleri bekler. Bahisler, canlı casino ve diğer oyunlar gibi aktiviteler erişilebilir hale gelir. Ayrıca güncel promosyonlar ve bonuslar takip edilebilir.

    Reply
  25. Rileyzew

    Just want to record that this site is entering my regular reading list, and a look at learnandapplywisely confirmed it deserves the spot, my regular reading list is short and well curated and adding to it requires meeting a fairly high quality bar that this site has clearly cleared without much effort apparently.

    Reply
  26. Manuelstict

    Useful reading material, the kind I can hand off to someone newer to the topic without worrying about confusing them, and a quick look at discoverinnovativepaths confirmed the same beginner friendly tone runs throughout the site which is great for sharing with people just starting their learning journey on this particular topic.

    Reply
  27. JamesSmoge

    Worth your time, that is the simplest endorsement I can give, and a stop at startbuildingclearvision extends that endorsement across the rest of the site, this is one of those increasingly rare places that delivers on what it promises rather than over selling the content and under delivering on substance every time which I find frustrating elsewhere.

    Reply
  28. Narkolog na dom_yvEl

    Народ, приветствую. Слушайте, вопрос сложный, но многим может помочь, особенно когда речь идет о близких людях. Когда нужен проверенный и опытный врач для капельницы, то не рискуйте и не доверяйте случайным объявлениям.

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

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

    Reply
  29. Sterlingnip

    My professional context would benefit from having this kind of resource available, and a look at findgrowthsolutionspath extended the professional applicability, the rare site that contributes meaningfully to professional work rather than just personal interest is content with multiplied value and this one is providing that professional utility consistently across multiple pieces.

    Reply
  30. KevinWal

    Honestly this was a good read, no jargon and no padding, and a short look at seospark kept that same feel going which I really appreciated, the writer clearly knows the topic well enough to explain it without hiding behind big words or filler that often gets used to seem clever.

    Reply
  31. Quinnmix

    Saving this link for the next time someone asks me about this topic, and a look at growwithclearstrategy expanded what I will be sharing with them, this is the kind of resource that makes a real difference when you are trying to point a friend to something useful and reliable rather than generic marketing pages.

    Reply
  32. AlfredohAm

    Glad to find a site whose links lead somewhere worth going rather than back to itself for SEO juice, and a stop at seometric kept that generous outbound feel, citing other peoples work with real respect rather than just for ranking signals is a sign of an honest operation worth supporting going forward.

    Reply
  33. Kak_gfkl

    Чтобы быстро и эффективно вычислить по номеру телефона, воспользуйтесь специализированными сервисами.
    В общем, тема такая, не для паники.
    Прямое обращение помогает получить согласие на обмен информацией.
    Короче, не нарывайтесь.

    Reply
  34. JayVox

    Easy to recommend, the content speaks for itself without needing additional praise from me, and a stop at createclaritydrivengrowth only adds more reasons to send people this way, the kind of generous resource that benefits its readers without demanding anything in return is increasingly rare and worth recognising clearly today across the broader open internet.

    Reply
  35. Percyted

    A piece that did not lean on the writer credentials or institutional backing, and a look at learnandoptimizepathwaynow maintained the same focus on substance, content that earns trust through quality rather than through name dropping is the kind I find most persuasive and this site is clearly playing on the substance side of that distinction.

    Reply
  36. BertSmach

    Now recognising the editorial wisdom of letting some questions remain open at the end, and a look at discovernewdirections continued that intellectual honesty, content that does not force closure on contested questions is content that respects the limits of knowledge and this site has clearly developed the maturity to know when to leave space.

    Reply
  37. Bjornpep

    Quietly enthusiastic about this site after the past few hours of reading, and a stop at learnandacceleratesuccess extended that enthusiasm, the calibration of enthusiasm to evidence is something I try to maintain and this site has earned a calibrated quiet enthusiasm rather than the loud excitement that usually fades within a day or two of finding something.

    Reply
  38. LelandVap

    A relief to read something where I did not have to fact check every claim mentally, and a look at createconsistentdirectionalgrowth continued that reliable feeling, sites where I can lower my guard and trust the content are rare and this one is earning that trust paragraph by paragraph through consistent careful work behind the scenes.

    Reply
  39. Davidsuh

    Honest assessment after reading this twice is that it holds up under careful attention, and a look at createforwarddirection extended that durability across more pages, content that survives a second read without revealing weak spots is rarer than the average reader probably realises and this site clearly cleared that bar.

    Reply
  40. melbet_jaSa

    Для тех, кто в теме, прямая ссылка. Нашел чистый вариант, в итоге скачал отсюда: мелбет казино скачать.

    Вообще проект сейчас один из лучших, линия на футбол и теннис огромная. Порадовало, что можно ставить прямо в режиме реального времени.

    Там сейчас дают неплохой приветственный бонус, рекомендую воспользоваться. Кто уже ставил там?

    Reply
  41. Kak_kikl

    Чтобы быстро и эффективно подробнее тут, воспользуйтесь платформами которые не врут.
    Слушай, тут главное — без глупостей.
    Соблюдение этики помогает избежать неприятностей и юридических последствий.
    Надеюсь, понятно объяснил.

    Reply
  42. EmeryDease

    Strong recommendation, anyone interested in this topic owes themselves a visit, and a stop at discovernewangles extends that recommendation across more of the site, this is the kind of resource that makes me more optimistic about the state of the open web than I usually am these days actually for once which is genuinely refreshing.

    Reply

Leave a Reply

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