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

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

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

  1. Ammonwax

    Reading this with my morning coffee turned into reading the related posts with my morning coffee, and a stop at jualpurehopeoil stretched the morning further, content that pulls breakfast into a reading session rather than just accompanying it is content that has earned a higher claim on my attention than the average article does.

    Reply
  2. Perryinved

    Considered alongside other sources I have been reading this one consistently rises to the top, and a stop at 6rtpibisawin maintained that top ranking, the informal ongoing comparison between sources is something I do whenever reading on a topic and this site keeps coming out near the top of those comparisons over many sessions.

    Reply
  3. Bartaginc

    My professional context would benefit from having this kind of resource available, and a look at loopconcepts 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
  4. TroyTitte

    Picked up a couple of new ideas here that I can actually try out, and after my visit to 2b808805 I have even more notes saved, this is the kind of resource that pays you back for the time you spend on it which is rare to come across in this corner of the web.

    Reply
  5. mejdynarodnie plateji_vcmn

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

    Reply
  6. mejdynarodnie plateji_qxka

    Нашёл интересный материал по этому вопросу — где предлагают адекватные условия для перевода денег за границу онлайн. Вот здесь всё по полочкам расписано: международные платежи https://mezhdunarodnye-platezhi-fra.ru Ключевой момент, на который стоит обратить внимание — разница в итоговой сумме бывает значительной. Дело в том, что любой трансграничный платёж — требует предварительного сравнения условий. Также стоит отметить — перед подтверждением перевода имеет смысл изучить актуальные тарифы. В противном случае можно получить менее выгодные условия. В итоге — необходимо проверять информацию перед любой отправкой средств.

    Reply
  7. Nicolasmem

    Great work on keeping things readable, the post never drags or repeats itself which I really appreciate, and a stop at antiromanticisma added a bit more context that fit naturally with what was already said here, no need to read everything twice to get the point being made today.

    Reply
  8. RockyGlync

    Started reading and ended an hour later without realising the time had passed, and a look at claritybuilder produced the same time dilation effect, when content makes time feel different the writer has achieved something well beyond the average and this site is producing that experience for me reliably across multiple readings.

    Reply
  9. AxelGam

    Without overstating it this is a quietly excellent post, and a look at sandbetgacor extended that quiet excellence, content that earns superlatives without demanding them through marketing language is content that has truly earned them through the substance and this site has clearly produced work in that earned excellence category today.

    Reply
  10. mejdynarodnie plateji_sdka

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

    Reply
  11. mejdynarodnie plateji_wdka

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

    Reply
  12. Duncantruby

    Solid value for anyone willing to read carefully, and a look at growthmovement extends that value across the rest of the site, this is the kind of place that rewards return visits rather than offering everything in a single splashy post and then leaving readers nothing to come back for later which is unfortunately common.

    Reply
  13. Scottaxiot

    If I had to defend the time I spend reading independent blogs this site would feature in the defence, and a look at minnesotarocks reinforced that defensive utility, the ongoing case for non algorithmic reading is one I make to myself periodically and sites like this one provide the actual evidence that supports the case clearly.

    Reply
  14. DarrenDuNse

    Felt slightly impressed without being able to point to one specific reason, and a look at commentariesa continued that diffuse positive feeling, when content works at a level you cannot easily articulate the writer is doing something with craft rather than just delivering information and that is something I have learned to recognise.

    Reply
  15. DavidQuoma

    Generally I bookmark sparingly to avoid building up a bookmark graveyard but this one earned a permanent slot, and a stop at a478884 extended that permanence designation, the few sites I keep permanent bookmarks for are sites I expect to use repeatedly and this one has clearly cleared that expectation bar today.

    Reply
  16. WalkerKes

    Just sat with this for a bit longer than I usually would because the points are worth thinking about, and after laskarlucky I had even more to chew on, the kind of post that nudges your thinking forward without forcing the issue is something I have always appreciated in good writing online.

    Reply
  17. Nicolasmem

    Speaking as someone who used to recommend blogs frequently and got out of the habit this site is rekindling that impulse, and a look at antiromanticisma extended the rekindling, the recovery of an old habit triggered by encountering work that justifies it is itself a small kind of pleasure and this site is providing that recovery experience.

    Reply
  18. Bradfordkiz

    Decided not to comment because the post said what needed saying, and a stop at ikeakancelarskystul continued that complete feel, content that does not invite obvious additions or corrections from readers is content that has been carefully considered and this site appears to consistently produce pieces that satisfy rather than provoke unnecessary follow ups.

    Reply
  19. Jimhab

    Recommend this to anyone who values clear thinking over flashy presentation, and a stop at beaconbevel continued in the same understated way, this site has its priorities in the right place which makes it worth supporting through repeat visits and recommendations rather than just one passing read today before moving on quickly elsewhere.

    Reply
  20. DavidQuoma

    Decided to set aside time later to read more carefully, and a stop at a478884 reinforced that decision, content that earns a calendar entry rather than just a passing read is in a different tier altogether and this site is clearly working at that elevated level which I really do appreciate as a reader today.

    Reply
  21. WalkerKes

    Reading this triggered a small reorganisation of my own thinking on the topic, and a stop at laskarlucky furthered that reorganisation, content that affects the shape of my mental model rather than just decorating it with new facts is content with structural rather than informational impact and this site provides that.

    Reply
  22. Franciscorat

    Now feeling that this site is the kind I want to make sure does not disappear, and a look at shortwatches reinforced that quiet protective feeling, the rare sites whose disappearance would actually matter to me are the sites I want to support through return visits and recommendations and this one has joined that small protected list.

    Reply
  23. Duncantruby

    Loved the writing voice here, friendly without being fake and confident without being arrogant, and a stop at growthmovement carried the same tone forward, the kind of personality that makes a reader feel welcome rather than lectured at which is a balance plenty of writers struggle to find no matter how long they have been at it.

    Reply
  24. Normannug

    If a friend asked me where to read carefully on the topic I would send them here without hesitation, and a look at pangfan confirmed the recommendation strength, the directness of my recommendation reflects how confident I am in the quality and this site has earned undiluted recommendations from me across multiple recent conversations actually.

    Reply
  25. mejdynarodnie plateji_ngsn

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

    Reply
  26. DrewAnync

    Walked away with a clearer head than I had before reading this, and a quick visit to providentkolcson only sharpened that, the writing has a way of cutting through the noise that surrounds most topics online which is something I will definitely remember the next time I am searching for an answer to anything.

    Reply
  27. Bradfordkiz

    Decided not to comment because the post said what needed saying, and a stop at ikeakancelarskystul continued that complete feel, content that does not invite obvious additions or corrections from readers is content that has been carefully considered and this site appears to consistently produce pieces that satisfy rather than provoke unnecessary follow ups.

    Reply
  28. JuliusMom

    Came away with a small but real shift in perspective on the topic, and a stop at 8499ng pushed that shift a bit further, the kind of subtle reframing that good writing does to a reader without making a big deal of it is something I always appreciate when it happens which is sadly not that often.

    Reply
  29. mejdynarodnie plateji_gxsi

    Постоянно возвращаюсь к одной теме — какой вариант реально рабочий для перевода денег за границу онлайн. На одном форуме вычитал — обязательно гляньте этот источник: международные транзакции международные транзакции Самое важное, что я понял — есть реальные подводные камни. Согласитесь любой подобный?? перевод — это риск потерять на конвертации. Обратите внимание — прежде чем отправлять проверьте актуальные отзывы. Без этого легко переплатить в два раза. Как итог — не поленитесь проверить информацию перед отправкой.

    Reply
  30. Lancecer

    Now considering the post as evidence that careful blog writing is still possible, and a look at zlg01 extended that evidence, the broader question of whether the modern web can sustain quality writing has obvious empirical answers in sites like this one and seeing them is reassuring even when they remain a minority overall today.

    Reply
  31. DavonNob

    Useful enough to recommend to several people I know who would appreciate it, and a stop at ldyssw504a 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
  32. Franciscorat

    Coming back tomorrow when I can give this a proper read, the post deserves better attention than I can give right now, and a look at shortwatches suggests there is plenty more here that deserves the same treatment, definitely a site I will be exploring properly over the next few days when I can.

    Reply
  33. mejdynarodnie plateji_vcsi

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

    Reply
  34. Normannug

    Reading this in a quiet coffee shop matched the calm energy of the writing, and a stop at pangfan extended that environmental match, content that has its own ambient quality which can match or clash with surroundings is content with a personality and this site has the kind of personality that suits calm reading.

    Reply
  35. Jimhab

    Reading this felt easy in the best way, no friction and no confusion at any point, and a stop at beaconbevel carried that same comfort across more pages, the kind of editorial flow that lets you absorb information without fighting the format which is increasingly hard to find on the open web today across topics.

    Reply
  36. DrewAnync

    Picked up on several small touches that suggest a careful editor, and a look at providentkolcson suggested the same hand at work across the broader site, editorial consistency at a granular level is one of the strongest signs that an operation is serious rather than just hobbyist and this site reads as serious throughout.

    Reply
  37. mejdynarodnie plateji_pxsn

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

    Reply
  38. Ashtonnuarm

    If I were grading sites on this topic this one would receive high marks, and a stop at baiduyunpro continued earning those high marks, the informal grading I do mentally for content sources is something I take seriously even though it is informal and this site has been receiving consistent high marks across multiple sessions today.

    Reply
  39. Ralphmaymn

    Liked everything about the experience, from the opening through to the closing notes, and a stop at bellboya extended that into more pages, finding a site where the editorial vision shows through every choice rather than feeling random is an increasingly rare experience and one I am glad to have today during this particular reading session.

    Reply
  40. JuliusMom

    My time on this site has now extended past what I had budgeted, and a stop at 8499ng keeps extending it further, content that overstays its budget in my schedule is content that has earned the extra time and this site has been earning extra time across multiple visits to the point where my schedule needs adjustment.

    Reply
  41. Lancecer

    Decided not to comment because the post said what needed saying, and a stop at zlg01 continued that complete feel, content that does not invite obvious additions or corrections from readers is content that has been carefully considered and this site appears to consistently produce pieces that satisfy rather than provoke unnecessary follow ups.

    Reply
  42. RolandSob

    Skipped a meeting reminder to finish the post, and a stop at businessfri held me past another reminder, when content beats meetings the writer is doing something extraordinary because meetings have institutional support behind them and yet good writing can still occasionally win that competition for attention which I find heartening today.

    Reply
  43. Evanlialt

    Thank you for keeping the writing honest and the points easy to verify against your own experience, and a stop at antronasala reflected the same approach, no exaggeration just steady useful content that I can take with me into my own work without second guessing every sentence I happen to read here.

    Reply
  44. 1xbet app_lvpn

    Ça fait longtemps que je voulais tester cette plateforme. Je n’arrivais pas à trouver la bonne version sur le Play Store. J’ai vérifié les dernières mises à jour pour lancer le processus sans erreur. J’ai finalement trouvé la bonne source et je voulais vous partager tous les détails, vous pouvez consulter les informations à jour ici: download 1xbet apk download 1xbet apk. En résumé, laissez-moi vous expliquer — l’application mobile fonctionne parfaitement bien.

    l’installation était simple et rapide, pas de souci à vous faire. Pour être honnête, c’est la plus fiable que j’ai trouvée — c’est de loin l’application la plus fluide. J’espère que vous serez aussi satisfaits que moi…

    Reply
  45. DavonNob

    A piece that did not require external context to follow, and a look at ldyssw504a maintained the same self contained quality, content that stands alone without forcing readers to chase prerequisites is more accessible and this site has clearly thought about how each piece can serve a fresh visitor rather than only existing members.

    Reply
  46. CarmeloBreby

    Honestly enjoyed not being sold anything for the entire duration of the post, and a look at aphoriaa kept that pleasant absence going across more pages, content that exists for its own sake rather than as a funnel to a paid product is increasingly rare and worth supporting where I can find it.

    Reply
  47. Johanfrogs

    Now feeling that this site is the kind I want to make sure does not disappear, and a look at dp50rbme reinforced that quiet protective feeling, the rare sites whose disappearance would actually matter to me are the sites I want to support through return visits and recommendations and this one has joined that small protected list.

    Reply
  48. JamalThype

    However selective I am about new bookmarks this one made it past my filter, and a look at 5gdaohang confirmed the bookmark was worth the slot, the precious slots in my permanent bookmark folder are difficult to earn and this site earned one without making me think twice about whether the slot was justified by the quality.

    Reply
  49. mejdynarodnie plateji_lamn

    Знаете, — как найти адекватный способ международных переводов. Друзья посоветовали вот этот обзор: переводы за рубеж https://mezhdunarodnye-platezhi-nar.ru Главное, что нужно понять — курсы валют часто кусаются. Потому что такая транзакция — это лотерея с банковскими комиссиями. Обратите внимание — прежде чем платить почитайте свежие отзывы. Без этого легко остаться в минусе. Резюмируя, — лучше один раз изучить тему.

    Reply
  50. mejdynarodnie plateji_yysi

    В общем, решил поделиться — какой вариант реально рабочий для перевода денег за границу онлайн. Пока сидел искал инфу — обязательно гляньте этот источник: платежи для импортеров https://mezhdunarodnye-platezhi-tov.ru Если по делу, то — есть реальные подводные камни. Потому что любой перевод за границу онлайн — это всегда головная боль без нормальной инфы. И да, кстати — перед финальным кликом посчитайте итоговую сумму с комиссиями. Без этого легко попасть на лишние траты. Моё мнение — стоит один раз разобраться.

    Reply

Leave a Reply

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