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

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

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

  1. Henryexina

    Just wanted to drop a quick note saying this was a useful read on a topic I have been circling, no fluff, and a stop at linencovevendorparlor added a few extra points that fit the same simple style which makes the whole site feel coherent rather than thrown together by many different writers with different goals.

    Reply
  2. Wilfredusabs

    Now saved this in a way that I will actually find again rather than the casual bookmark approach, and a stop at startnextleveldirectionfast earned the same careful saving, organising my reading bookmarks so that high quality sources rise to the top is something I should do more of and this site triggered that organisation today.

    Reply
  3. DaltonFilla

    If patience for careful reading is rare these days finding sites that reward it is rarer still, and a stop at growwithsteadyfocus extended that rare reward, the diminishing returns on shallow content reading have made me more selective about where to spend reading time and this site is meeting the higher selectivity bar consistently.

    Reply
  4. KeenanDoM

    Honestly this hits the sweet spot between detail and brevity, no rambling and no shortcuts, and a quick visit to explorefreshroutes kept that going across the related pages, the kind of place that respects your attention without trying to grab it through cheap tactics or attention seeking design choices that get tired fast.

    Reply
  5. Roryaffer

    Liked that there was nothing performative about the writing, and a stop at jadyam continued that genuine quality, performative writing tries to be witnessed rather than read and the difference between performance and substance is huge for the careful reader and this site has clearly chosen substance every time clearly.

    Reply
  6. StanleyWaync

    Now wishing more sites covered topics with this level of care, and a look at directionalclarityhub extended that wish across more subjects, the rarity of careful coverage on most topics is a problem and this site is one of the small antidotes to that broader pattern of casual or surface treatment of complex subjects.

    Reply
  7. YusufCoind

    Now wishing more sites covered topics with this level of care, and a look at actionwithalignment extended that wish across more subjects, the rarity of careful coverage on most topics is a problem and this site is one of the small antidotes to that broader pattern of casual or surface treatment of complex subjects.

    Reply
  8. 1xbet giris_mpPt

    Ac?kcas? sas?rd?m kalitesine. Surekli adres degisiyor. En sonunda dogru adrese ulast?m.

    Spor bahisleriyle ilgilenenler bilir. Su an en h?zl? cal?san 1xbet yeni giris adresi tam olarak soyle: 1xbet yeni giriş 1xbet yeni giriş. Yani k?sacas? — 1xbet turkiye icin tek adres buras?.

    Denemek isteyen kac?rmas?n. Tavsiye eden c?kt? m? emin olun — arayuz zaten al?s?k oldugunuz gibi. Gonul rahatl?g?yla girebilirsiniz…

    Reply
  9. GuyEnata

    Reading carefully this time rather than scanning, and the depth shows up in places I missed first time around, and a look at createclearprogresspath rewarded the same careful approach, content that holds up to multiple reads is content I want more of in my regular rotation rather than disposable scroll fodder daily.

    Reply
  10. skolko stoit yzakonit pereplanirovky_qyKn

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

    Reply
  11. PauldoR

    Now realising this site has been quietly doing good work for longer than I knew, and a look at startwithclearstrategyfocus suggested an archive worth exploring, sites with deep archives of consistent quality represent a different kind of resource than sites with viral hits and this one looks like the durable kind based on what I see.

    Reply
  12. Owenpruri

    A small editorial detail caught my attention, the way headings related to body text, and a look at buildwithpurposefulsteps maintained that careful relationship, structural details like that show up to readers who notice them and the writers here have clearly thought about every level of the piece rather than just the words.

    Reply
  13. Wileyfaica

    Closed three other tabs to focus on this one and never opened them again, and a stop at learnandadvanceclearly similarly held attention exclusively, content that crowds out other reading from working memory is content with real density and this site has demonstrated that density across multiple pages I have visited so far this morning.

    Reply
  14. MarcoWaill

    Glad the writer did not feel the need to argue with imaginary critics in the post itself, and a stop at learnandprogressconsistently 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
  15. Henryexina

    Found something quietly useful here that I expect to return to, and a stop at linencovevendorparlor added more of the same, content with quiet utility ages well in a way that flashy hot takes do not and I have learned to weight quiet utility much higher when deciding what to bookmark for later use.

    Reply
  16. DwightOxype

    Found the writing surprisingly fresh for what is by now a well covered topic, and a stop at buildlongtermvision kept that freshness going across the related pages, original perspective on familiar ground is hard to come by and this site has clearly earned its place in the conversation rather than just rehashing old ideas.

    Reply
  17. KelbyZoorn

    A quiet piece that did not try to compete on volume, and a look at startpurposefuldirection maintained that selective approach, sites that publish less but better are increasingly rare in an environment that rewards volume and this one has clearly chosen quality cadence over quantity which is a brave editorial decision in current conditions.

    Reply
  18. shkola_raon

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

    Reply
  19. shkola_pbon

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

    Reply
  20. DaltonFilla

    Speaking as someone who reads a lot on this topic this site has earned a high position in my source rankings, and a stop at growwithsteadyfocus reinforced that ranking, the informal ranking of sources for a topic is something I maintain mentally and this site has moved into the upper portion of those rankings clearly.

    Reply
  21. Roryaffer

    A particular pleasure to read this with a fresh coffee, and a look at jadyam extended the pleasure across more pages, content that pairs well with quiet morning rituals is something I have come to value highly and this site has the kind of energy that fits naturally into a calm reading routine.

    Reply
  22. vivod iz zapoya v stacionare_pbsr

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

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

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

    Reply
  23. 1xbet giris_ffPt

    Deneyip de begenen cok oldu. Baz? siteler cal?sm?yor. En sonunda dogru adrese ulast?m.

    Bu isin puf noktalar? var. Su an en h?zl? cal?san 1xbet giris adresi tam olarak soyle: 1xbet yeni giriş 1xbet yeni giriş. Herkesin bildigi gibi — 1xbet turkiye icin tek adres buras?.

    Sorunsuz baglant? icin bu link yeterli. Tavsiye eden c?kt? m? emin olun — canl? destekleri bile h?zl?. Gonul rahatl?g?yla girebilirsiniz…

    Reply
  24. LorenzoRab

    I usually skim posts like these but this one held my attention all the way through, and a stop at exploreuntappedopportunities did the same, that is a strong endorsement coming from me because I am usually quick to bounce when content gets repetitive or fails to deliver on its initial promise made in the headline.

    Reply
  25. YusufCoind

    Compared to the usual results for this kind of search this site stands well above the average, and a quick visit to actionwithalignment kept the standard high, you can tell within seconds whether a site is going to waste your time or actually deliver and this one clearly delivers without any false starts.

    Reply
  26. GuyEnata

    Reading this in three sittings because the day was fragmented, and the piece survived the fragmentation, and a stop at createclearprogresspath held up under similar reading conditions, content engineered for continuous attention is fragile in modern conditions and this site reads as durable across the realistic ways people consume content today.

    Reply
  27. Alecvioks

    Liked that the post resisted a sales pitch ending, and a stop at createimpactplanning maintained the no pitch approach, content that ends without trying to convert me into a customer or subscriber is content that has confidence in its own value and this site is clearly playing the long game on reader trust.

    Reply
  28. Rickyswela

    A piece that exhibited the kind of patience that good writing requires, and a look at exploreideaswithfocus continued that patient quality, hurried writing is easy to spot and this site reads as having been written without time pressure which produces a different feel than the rushed content that dominates much of the modern blog space.

    Reply
  29. OmarPitty

    Now appreciating that the post did not require me to agree with the writer to find it valuable, and a look at buildlongtermfocus maintained the same useful regardless of agreement quality, content that informs even when it does not convince is content with broader utility and this site reads as useful even when I disagree.

    Reply
  30. Wileyfaica

    Felt this in a way I cannot quite explain, the topic just hit different here, and a stop at learnandadvanceclearly continued in that vein, sometimes you find a site whose perspective lines up with how you have been thinking and reading their work feels like a small relief which I appreciated more than I expected.

    Reply
  31. WesleyHoins

    Decided to read this site for a while before forming a verdict, and the verdict after several pages is positive, and a stop at progressbystrategy continued that pattern, judging a site requires more than one post and giving sites a fair sample is something I try to do for promising candidates rather than rushing to dismiss.

    Reply
  32. BarneyFer

    This one is staying open in a tab for the rest of the day so I can come back and re read certain parts, and a look at unlocknewpotentialnow suggests I will be doing the same with a few more pages here too, this is going to be a deep dive over the coming hours.

    Reply
  33. Jaketreat

    Came across this through a roundabout path and now it is on my regular rotation, and a stop at createimpactdirectionplan sealed that decision, the open web still produces serendipitous discoveries when you let the citations and references guide you rather than relying purely on algorithmic feeds for new content recommendations always.

    Reply
  34. DwightOxype

    Most of my reading time goes to a small number of trusted sources and this one is now joining that group, and a stop at buildlongtermvision reinforced the group membership, the few sites that earn a place in my regular rotation are sites I expect ongoing returns from and this one has earned that elevated position consistently.

    Reply
  35. BillFex

    Did not expect much when I clicked through but ended up reading the whole thing carefully, and a stop at discovernewfocusareasnow kept that engagement going, sometimes the unassuming sites turn out to deliver more than the flashy ones which is something I have learned to look out for over time online lately and across topics.

    Reply
  36. KerryAstof

    Thanks for taking the time to write this, it is clear that some thought went into how each point would land, and after I went through findgrowthpotential I had a better grip on the topic, real value without the usual marketing noise people have to put up with online when searching for answers.

    Reply
  37. KelbyZoorn

    If I were to recommend a starting point for the topic this site would be near the top of my list, and a stop at startpurposefuldirection reinforced that recommendation status, the small list of starting point recommendations I keep for friends asking about topics is short and this site is now firmly on it.

    Reply
  38. vivod iz zapoya v stacionare_jisr

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

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

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

    Reply
  39. Zacharyevest

    Worth saying that the quiet confidence of the writing is what landed first, and a look at discoverhiddenroutes continued that quiet quality, confident writing without the loud display of confidence is a rare combination and this site has clearly developed both the knowledge and the editorial restraint to land that combination consistently.

    Reply
  40. LorenzoRab

    Now adding this site to a small mental group of recommendations I keep ready for specific kinds of inquiries, and a stop at exploreuntappedopportunities extended the recommendation readiness, content that I can confidently point friends and colleagues toward in specific contexts is content with real social utility and this site has that utility clearly.

    Reply
  41. LelandTew

    Loved the writing voice here, friendly without being fake and confident without being arrogant, and a stop at startsmartmovementnow 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
  42. Owenpruri

    Bookmark earned and folder updated to track this site separately, and a look at buildwithpurposefulsteps confirmed the folder upgrade was the right call, organising my reading list so that good sites do not get lost in a sea of casual bookmarks is something I do more carefully now and this site warranted its own spot.

    Reply
  43. Rickyswela

    Skipped past the first paragraph thinking it was setup and had to come back when the rest referenced it, and a stop at exploreideaswithfocus similarly rewarded careful reading from the start, content where every paragraph carries weight is content I now know to read from the beginning rather than skipping ahead.

    Reply
  44. WesleyHoins

    Worth a quiet moment of recognition for the consistency I have noticed across multiple posts, and a stop at progressbystrategy continued that consistent quality, sites that maintain quality across many pieces rather than peaking on one viral post are sites with real editorial discipline and this one has clearly developed that discipline carefully.

    Reply
  45. JimmyMem

    A clean read with no irritations, and a look at oliveorchard 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
  46. BillFex

    Came in expecting another generic take and got something with actual character instead, and a look at discovernewfocusareasnow carried that personality forward, finding a distinct voice on a saturated topic is impressive and worth pointing out when it happens because most sites end up sounding identical to their nearest competitors quickly.

    Reply
  47. Leonlor

    Such writing is increasingly rare and worth supporting through attention, and a stop at actioncreatesresults extended that supportive attention across more pages, the conscious choice to spend time on sites that produce careful work rather than convenient consumption is itself a small form of patronage and this site is receiving that conscious patronage from me.

    Reply
  48. 1xbet giris_cxPt

    Deneyip de begenen cok oldu. Baz? siteler cal?sm?yor. En sonunda guvenilir bir kaynak buldum.

    Spor bahisleriyle ilgilenenler bilir. Su an en sorunsuz cal?san 1xbet guncel giris adresi tam olarak soyle: 1xbet spor bahislerinin adresi 1xbet spor bahislerinin adresi. Herkesin bildigi gibi — 1xbet turkiye icin tek adres buras?.

    Denemek isteyen kac?rmas?n. Kendi deneyimim buysa da — arayuz zaten al?s?k oldugunuz gibi. Baska yerde aramay?n art?k…

    Reply
  49. shkola onlain_aoSt

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

    Reply
  50. Emerytrini

    Reading this between two meetings turned out to be the highlight of the morning, and a stop at jalaxis continued that highlight quality, content that outshines the structured parts of a working day is doing something well beyond ordinary and this site has produced multiple such highlights for me already this week alone.

    Reply

Leave a Reply

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