网站/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,266 thoughts on “网站/WordPress从虚拟主机搬家到VPS上

  1. DominicAxior

    Really like that there are no exclamation marks or all caps shouting throughout the post, and a quick visit to bakeboxshop maintained the same calm voice, restraint in punctuation signals confidence in the content and this site clearly trusts its substance to do the persuading rather than relying on typographic emphasis.

    Reply
  2. crazy_zlOi

    Se vuoi vivere l’emozione unica del gioco d’azzardo, non perdere l’occasione di provare crazy time casino gratis per scoprire il miglior intrattenimento casino in Italia!
    In Italia, Crazy Time Slot Casino e riconosciuto come uno dei casino online piu famosi. I giocatori amano Crazy Time Slot Casino in Italia soprattutto per la sua ricca selezione di slot e la navigazione semplice. Molti puntano su Crazy Time Slot Casino Italy grazie alle sue misure di sicurezza e alla serieta del servizio.
    L’interfaccia utente e stata progettata per essere accessibile a tutti, anche ai principianti. Le animazioni fluide e gli effetti sonori aiutano a rendere il gioco piu emozionante e realistico. Gli utenti possono accedere facilmente dalla versione mobile senza perdere qualita ne funzionalita.

    Reply
  3. shkola onlain_pvSt

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

    Reply
  4. 1xbet giris_zlPt

    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 güncel 1xbet güncel. Ne demisler — 1xbet guncel adres arayanlar buraya baks?n.

    Denemek isteyen kac?rmas?n. Tavsiye eden c?kt? m? emin olun — cekim konusunda s?k?nt? yasamad?m. Gonul rahatl?g?yla girebilirsiniz…

    Reply
  5. skolko stoit yzakonit pereplanirovky_ifKn

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

    Reply
  6. Mathewerubs

    Reading this on a phone at a coffee shop and finding it perfectly suited to that context, and a stop at growwithfocusedintent continued the comfortable mobile experience, content that works across reading conditions without compromising on substance is increasingly important and this site has clearly thought about the whole reader experience here.

    Reply
  7. BenniejEr

    Closed it feeling slightly more competent in the topic than I started, and a stop at buildalignedprogress reinforced that competence boost, real learning is rare in casual online reading but it does happen sometimes and this site managed to make it happen for me today which is genuinely worth pausing to acknowledge.

    Reply
  8. Walterses

    Now recognising the editorial wisdom of letting some questions remain open at the end, and a look at unlockcreativepaths 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
  9. DrewMut

    A genuine pleasure to find a site that publishes at a sustainable cadence rather than chasing the daily content treadmill, and a look at buildgrowthdirectionplan confirmed the careful publication rhythm, sites that prioritise quality over frequency are rare and this one has clearly chosen the slower pace which I appreciate as a reader.

    Reply
  10. 1xbet giris_rcPt

    Deneyip de begenen cok oldu. Baz? siteler cal?sm?yor. En sonunda her seyi cozdum.

    Ozellikle bahis ve casino sevenler icin. Su an en guncel cal?san 1xbet giris adresi tam olarak soyle: 1xbet güncel adres 1xbet güncel adres. Herkesin bildigi gibi — 1xbet spor bahislerinin adresi degisti.

    Sorunsuz baglant? icin bu link yeterli. Kim ne derse desin — canl? destekleri bile h?zl?. Baska yerde aramay?n art?k…

    Reply
  11. Lucaenemn

    Decided to write a short note to the author if there is contact info anywhere, and a stop at explorefreshopportunityzones extended that intention, the urge to thank the writer directly is a strong signal of content quality and this site has triggered that urge in me today which is a fairly rare event for my reading.

    Reply
  12. Caseyelela

    Stands apart from similar pages by actually being useful, that is high praise these days, and a look at learnandexecuteeffectively kept that standard going, you can tell when a site is built around the reader versus around metrics and this one clearly belongs to the first category for sure based on what I read.

    Reply
  13. DaveKeP

    Thanks for the practical examples scattered through the post rather than abstract theory only, and a look at growthbydesign continued that grounded style, abstract points are easier to remember when paired with concrete situations and the writers here clearly understand how readers actually retain information from blog content reading sessions.

    Reply
  14. Mathewerubs

    Now noticing that the post avoided the temptation to be funny in places where humour would have undermined the substance, and a stop at growwithfocusedintent 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
  15. HarveyDrymn

    Found the use of subheadings really helpful for scanning back through the post later, and a stop at ignitefreshthinking kept that reader friendly approach going, navigation is something many blog writers ignore but small structural choices make a noticeable difference for someone returning to find a specific point again days or weeks later.

    Reply
  16. DuaneFus

    A piece that did not lecture even when it had clear positions, and a look at createforwardthinkingsteps maintained the same teaching without preaching tone, finding the line between informing and lecturing is hard and most sites land on the wrong side of it but this one has clearly figured out how to inform without becoming preachy.

    Reply
  17. RussellSep

    Found this through a search that was generic enough I did not expect quality results, and a look at discovergrowthdirection continued the surprisingly good experience, search engines occasionally still surface excellent independent content if you scroll past the obvious paid and high authority results which is reassuring to remember sometimes.

    Reply
  18. IraPic

    Reading this back to back with a similar piece elsewhere made the quality difference obvious, and a stop at findyournextfocus only widened the gap, comparing content side by side is a useful exercise and the gap between this site and average competitors in the space is large enough to be noticeable from the first paragraph.

    Reply
  19. tkan dlya mebeli_bpkn

    Ребята, выручайте! Купил кресло б/у, каркас норм, но ткань в ужасном состоянии. Посоветуйте нормальную мебельную ткань для частого использования. мебельная ткань https://tkan-dlya-mebeli-1.ru А то везде пишут разное, а на деле хочется купить ткань мебельную и забыть на пару лет. Буду благодарен за любые советы, особенно от тех, кто сам перетягивал.

    Reply
  20. BenniejEr

    Pass this along to anyone you know dealing with similar questions, the answers here are clear, and a stop at buildalignedprogress adds even more useful material, this is the kind of resource that deserves to circulate widely rather than getting lost in the constant churn of new content online that buries good work daily.

    Reply
  21. shkola onlain_sfSt

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

    Reply
  22. shkola onlain_dkSt

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

    Reply
  23. skolko stoit yzakonit pereplanirovky_nsKn

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

    Reply
  24. skolko stoit yzakonit pereplanirovky_yfKn

    Ребята, привет! Долго думал, стоит ли начинать эту волокиту. Поменяли газовую плиту, сдвинули раковину, а стены вообще вынесли — думал, пронесёт. В общем, инспекция пришла и выписала предписание. И тут встал вопрос: сколько стоит оформить перепланировку квартиры https://skolko-stoit-uzakonit-pereplanirovku-10.ru просто интересно, стоимость согласования перепланировки квартиры сейчас вообще реальная или грабёж. Плюс эти дурацкие техусловия на вентиляцию. Если кто недавно проходил это ад, поделитесь. Без этого а если решите ипотеку рефинансировать, БТИ зарубит. Короче, нужна стоимость согласования перепланировки, реальная по рынку.

    Reply
  25. BrockBab

    Probably going to mention this site in a write up I am working on later this month, and a stop at learnandadvancepathnow provided more material for that potential mention, content worth referencing in my own published work rather than just personal reading is content with the highest endorsement level and this site has earned that endorsement.

    Reply
  26. Kak naiti cheloveka po nomery telefona_ztoa

    Долго рылся в интернете на разных форумах, Прям беда реальная: потерял контакт со старым хорошим другом. Полез в глубокий поиск по веткам. И знаете что? Не всё так сложно в этом плане, как кажется.

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

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

    Reply
  27. Kak naiti cheloveka po nomery telefona_zwoa

    Случайно наткнулся на один гайд, Знакомая многим фигня, постоянно звонят с незнакомого телефона, а кто — вообще непонятно. Полез в глубокий поиск по веткам. И знаете что? Не всё так сложно в этом плане, как кажется.

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

    Я сам сначала вообще не верил во всё это. Потому что а тут выложена конкретная и структурированная информация. В общем, обязательно сохраните себе на будущее. Тема вроде избитая, но толковое решение всё же нашлось.

    Reply
  28. syvenirnaya prodykciya s logotipom_clSl

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

    Reply
  29. DrewMut

    Reading this as part of my evening winding down routine fit perfectly, and a stop at buildgrowthdirectionplan extended the wind down nicely, content that calms rather than agitates is what I want at the end of the day and this site provides that calming reading experience reliably which is increasingly rare across the modern web.

    Reply
  30. Lucaenemn

    Skipped a meeting reminder to finish the post, and a stop at explorefreshopportunityzones 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
  31. syvenirnaya prodykciya s logotipom_pimr

    Коллеги, всем привет! Встала задача обновить ассортимент брендированной атрибуки для отдела продаж. Подскажите, где заказать качественную сувенирную продукцию с логотипом. аксессуары с логотипом https://suvenirnaya-produkcziya-s-logotipom-11.ru Где сейчас лучше заказывать корпоративные подарки сувениры — в России или все-таки из Китая везти. Может, есть проверенные фабрики, которые работают напрямую, без посредников. Киньте ссылки или названия компаний, буду очень благодарен.

    Reply
  32. Fletcherzet

    Speaking from the perspective of having read widely on the topic this site offers something distinct, and a look at fromthinkingtodoing reinforced that distinctness, the rare site that contributes something genuinely original to a saturated topic is the rare site worth following carefully and this one has demonstrated that original contribution capability today.

    Reply
  33. NathanielShofe

    Reading this prompted me to dig out an old reference book related to the topic, and a stop at buildsmartdirectionplan extended that connection to other sources, content that connects me back to my own existing knowledge rather than asking me to forget it is content with continuity and this site has that continuous quality.

    Reply
  34. JimmyEmult

    Even on a quick first read the substance of the post comes through, and a look at bulkingbayou reinforced that immediate quality, content that does not require a slow careful read to demonstrate value but rewards one anyway is content with real depth and this site has produced work of that demanding depth class.

    Reply
  35. CharlieAcili

    Liked that the post left some questions open rather than pretending to settle everything, and a stop at learnandscaleideas continued that intellectual honesty, content that respects the limits of its own claims is more trustworthy than content that overreaches and this site has clearly figured out which positions it can defend confidently.

    Reply
  36. HarveyDrymn

    Picked up several practical tips that I plan to try out this week, and a look at ignitefreshthinking added a few more I will be testing alongside, content with practical hooks that connect to my actual life is the kind that earns my repeat attention rather than the merely interesting that I forget within a day.

    Reply
  37. LarryMib

    Decided to subscribe to the RSS feed if there is one, and a stop at explorefuturepathwaysnow confirmed that decision, content that I want delivered to me proactively rather than just remembered when I have time is content that has earned a higher level of commitment from me as a reader looking for reliable sources.

    Reply
  38. vivod iz zapoya v stacionare_husr

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

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

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

    Reply
  39. 1xbet giris_uuPt

    Ac?kcas? sas?rd?m kalitesine. Baz? siteler cal?sm?yor. En sonunda her seyi cozdum.

    Spor bahisleriyle ilgilenenler bilir. Su an en sorunsuz cal?san 1xbet guncel giris adresi tam olarak soyle: 1xbet güncel adres 1xbet güncel adres. Ne demisler — 1xbet guncel adres arayanlar buraya baks?n.

    Site s?k s?k kapan?yor diyenlere inat. Kendi deneyimim buysa da — cekim konusunda s?k?nt? yasamad?m. Baska yerde aramay?n art?k…

    Reply
  40. ColbyAbify

    Took something from this I did not expect to find, and a stop at learnandacceleratesuccess added another unexpected useful piece, content that exceeds expectations rather than just meeting them is the kind that builds enthusiasm and earns repeat visits without any explicit ask from the writer or platform behind the work being read.

    Reply
  41. MicahStoff

    I learned more from this short post than from longer articles I read earlier today, and a stop at startthinkingstrategicallynow added even more useful detail without going off topic, this site clearly knows how to keep things focused without sacrificing depth which is a hard balance to strike for any writer.

    Reply
  42. 1xbet giris_vaPt

    Deneyip de begenen cok oldu. Baz? siteler cal?sm?yor. En sonunda her seyi cozdum.

    Ozellikle bahis ve casino sevenler icin. Su an en h?zl? cal?san 1xbet guncel giris adresi tam olarak soyle: 1xbet giriş 1xbet giriş. Yani k?sacas? — 1xbet turkiye icin tek adres buras?.

    Sorunsuz baglant? icin bu link yeterli. Kim ne derse desin — cekim konusunda s?k?nt? yasamad?m. Baska yerde aramay?n art?k…

    Reply
  43. JimmyEmult

    Looking forward to seeing what gets published next month, and a look at bulkingbayou extended that anticipation across the broader site, finding myself looking forward to a sites future content rather than just consuming its existing content is a stronger commitment level than I usually reach with new finds and this site triggered that.

    Reply
  44. NathanielShofe

    Reading this on a long flight and finding it the best thing I read across hours of trying, and a stop at buildsmartdirectionplan kept the streak going, when content beats long flight reading you know it has substance because flight reading is a hard test of a piece given the alternatives available everywhere.

    Reply
  45. Sebastianjef

    Felt the post had been written without looking over its shoulder, and a look at startsmartdirection continued that confident posture, content written for its own sake rather than against imagined critics has a different quality and this site reads as written from a place of confidence rather than defensive justification of every claim.

    Reply
  46. DuaneFus

    A piece that read smoothly because the writer understood how readers actually move through prose, and a look at createforwardthinkingsteps maintained the same reader awareness, writers who think about the reading experience as much as the writing experience produce better work and this site has clearly made that shift in editorial approach.

    Reply

Leave a Reply

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