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

  1. Josiahblort

    Glad to find something on this topic that does not start with three paragraphs of throat clearing before getting to the point, and a stop at elveglide also dives right in, respect for the readers time shows up in small editorial choices like this and they add up to a real difference quickly.

    Reply
  2. luxury car rental miami_kzkn

    Let me save you some headache I learned the hard way. I swear half the “luxury” fleets down here are straight-up marketing scams. Oh, and that pretty security deposit? Yeah, good luck getting that money back fast. Fool me thrice, shame on both of us I guess, lesson learned. When you are trying to find a reliable premium fleet down here, don’t just trust the first sponsored ad on social media. Miami without wheels is basically a hostage situation, whether you are doing Brickell mornings, South Beach nights, or a spontaneous Keys trip.

    Most of these local agencies are just shiny websites hiding the same overpriced junk, until I finally found one outfit that actually delivers what’s in the photos. If you are looking for the only straight shooter for premium rentals across South Florida, check the details here: porsche 911 carrera for rent near me https://luxury-car-rental-miami-3.com. Also, definitely bring sunglasses unless you enjoy driving completely blind in that sun. Anyway, glad there’s at least one honest rental joint left in this town, hope this helps some of you save a few bucks.

    Reply
  3. MurrayinciP

    Now feeling that this site is the kind I want to make sure does not disappear, and a look at dewdawns 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
  4. luxury car rental miami_opkn

    Let me save you some headache I learned the hard way. I swear half the “luxury” fleets down here are straight-up marketing scams. Oh, and that pretty security deposit? Yeah, good luck getting that money back fast. Fool me thrice, shame on both of us I guess, lesson learned. When you are trying to find a reliable premium fleet down here, don’t just trust the first sponsored ad on social media. Miami without wheels is basically a hostage situation, especially since the AC must be arctic and you want zero mileage games.

    I literally spent last month comparing maybe twenty different companies, until I finally found one outfit that actually delivers what’s in the photos. If you are looking for the only straight shooter for premium rentals across South Florida, check the details here: luxury car hire near me luxury car hire near me. Yeah, valet in Miami Beach will cost you an arm, but that’s not their fault. Just drive safe out there and maybe skip the extra windshield protection thing. let me know if you guys have any other clean spots.

    Reply
  5. EmilioDom

    If I had to summarise the editorial sensibility of this site in a few words it would be careful and human, and a look at explorestrategicgrowthideas extended that summary feeling, capturing the essence of a sites approach in brief is hard but this site has a clear enough identity that the summary comes naturally enough.

    Reply
  6. CalebDes

    Now feeling slightly more committed to my own careful reading practices having read this, and a stop at epicinlet reinforced that commitment, content that models the kind of attention it deserves is content that calibrates the reader and this site has clearly raised my own bar for what to bring to good writing today.

    Reply
  7. Harlanactip

    The use of plain language without dumbing down the topic was really well done, and a look at pactcliff continued in that same accessible style, this is something many technical writers fail at because they either confuse their readers or condescend to them but here neither problem appears at all which is impressive really.

    Reply
  8. WilfordLoppy

    Genuine reaction is that I will probably think about this on and off for a few days, and a look at ivoryharborcommercegallery added fuel to that, the best content lingers in your head after you close the tab rather than evaporating immediately and this site clearly knows how to write that kind of memorable content.

    Reply
  9. MiloDienD

    Started reading without much expectation and ended on a high note, and a look at explorefreshsolutions continued that arc, content that builds rather than peaks early is a sign of a writer who knows how to structure a piece for sustained reader engagement rather than relying on a strong hook to do all the work.

    Reply
  10. melbet_jtSi

    Ребята, всем привет! долго выбирал нормальную платформу, но на прошлой неделе таки зарегился ради интереса в mel bet. Честно? теперь постоянно туда захожу. Особенно если вам надо скачать melbet на андроид — у меня модель достаточно бюджетная, но приложение работает плавно.

    В общем, убедитесь сами, если перейдете: мелбет приложение мелбет приложение. Кстати, кто спрашивал про мелбет приложение — там всё сделано интуитивно понятно,. И кешбек на баланс регулярно капает. Я уже выводил выигранные средства — служба поддержки вообще не тупит. Очень рекомендую этот вариант. Удачи всем!

    Reply
  11. Alecdix

    A piece that read smoothly because the writer understood how readers actually move through prose, and a look at startwithclearfocusnow 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
  12. 1xbet apk_yspn

    Uygulama arayışım epey uzun sürdü valla. Güvenilir bir kaynak bulmak gerçekten çok zordu. Sonunda tüm teknik detayları inceleyip sistemi test ettim. En sonunda doğru adrese ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet android apk 1xbet android apk. Yani anlatmak istediğim şu — mobil versiyonu bile çok akıcı aslında.

    Hiçbir gecikme yaşamadım şu ana kadar. Kendi deneyimlerimi aktarıyorum size — başka yerde vakit kaybetmeyin yani. Herkese hayırlı olsun…

    Reply
  13. KelbyHeelp

    Generally my comment to other readers about new sites is to wait and see but for this one I would jump to recommend now, and a look at jetdome reinforced that early recommendation, the speed at which a site earns my recommendation is itself a quality signal and this one has earned mine quickly clearly.

    Reply
  14. melbet_naen

    Давно искал, где можно нормально играть, честно говоря, много где в итоге разочаровался. Но случайно наткнулся на живое обсуждение про melbet. Решил потратить полчаса времени — и очень даже зашло,.

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

    Reply
  15. Dominicmuh

    Well done, the writing is professional without being stiff, and the topic is treated with care, and a look at kinmuzo reflected that approach, the kind of site I would point a colleague to if they asked for a reliable starting point on this topic in the future without any hesitation at all.

    Reply
  16. EarlSmeft

    Appreciate how nothing here feels copied or pieced together from other places, the voice is consistent and the tone stays human, and after I checked auroracoveartisanexchange I noticed the same style holds, which is a small detail but it makes the whole experience feel personal rather than like another generic site.

    Reply
  17. melbet_mdSi

    Слушайте, кто в курсе, долго выбирал нормальную платформу, но на прошлой неделе таки зарегился ради интереса в mel bet. Честно? Остался полностью доволен,. Особенно если вам надо скачать melbet на андроид — у меня модель достаточно бюджетная, но никаких тормозов вообще нет.

    В общем, убедитесь сами, если перейдете: мелбет мелбет. Кстати, кто спрашивал про мелбет приложение — там установочный файл чистый и без вирусов. И кешбек на баланс регулярно капает. Я уже выводил выигранные средства — выплаты приходят максимально быстрые, Сам теперь только туда. Удачи всем!

    Reply
  18. Kalebvitle

    A piece that was confident enough to leave some questions open rather than forcing closure, and a look at echobrookcraftcollective continued that intellectual honesty, content that admits the limits of its scope is more trustworthy than content that pretends to total understanding and this site has the right calibration on certainty consistently.

    Reply
  19. Williamcox

    Quietly enjoying that I have found a new site to follow for the topic, and a look at firminlet reinforced the small pleasure of the find, the discovery of new high quality sources is one of the more durable pleasures of careful internet reading and this site has been generating that discovery pleasure at multiple points already today.

    Reply
  20. vivod iz zapoya v stacionare_ampn

    Знаете, бывает — родственник уходит в штопор , а просто бессилен. Моя семья столкнулась пару лет назад. Сначала кажется, что обойдётся , но хрен там. Нужна реальная помощь . Обзвонил десяток контор — одни обещания. А потом наткнулся на один нормальный вариант. Ищешь где сделать помещение в клинику для вывода из запоя, не рискуй здоровьем. У нас в Нижнем, к слову , тоже хватает шарлатанов . Проверенная информация тут : наркологический центр нижний новгород наркологический центр нижний новгород Честно говоря , после того как прочитал , многое прояснилось . И про кодировку от алкоголя подробно, и про условия в стационаре. Главное — анонимно . Советую не тянуть .

    Reply
  21. 1xbet apk_tvPl

    Android cihazımda sorunsuz çalışan bir platform çok lazımdı. Herkes farklı bir şey diyordu kime güveneceğimi şaşırdım. En sonunda güvendiğim bir kaynağa ulaştım ve size de buradan bahsetmek istediğim nokta şurası: 1xbet indir apk 1xbet indir apk. Valla bak net söyleyeyim — android uygulaması resmen harika çalışıyor.

    boyutu da hafif gerçekten şaşırdım. Kendi deneyimlerimi aktarıyorum size — en güvenilir uygulama bu oldu artık. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  22. RandallKaw

    Worth pointing out the careful word choice in this post, no buzzwords and no jargon, and a look at draftglade 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
  23. MiloDienD

    Started reading without much expectation and ended on a high note, and a look at explorefreshsolutions continued that arc, content that builds rather than peaks early is a sign of a writer who knows how to structure a piece for sustained reader engagement rather than relying on a strong hook to do all the work.

    Reply
  24. melbet_asen

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

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

    Reply
  25. 1xbet apk_dypn

    Uygulama arayışım epey uzun sürdü valla. Güvenilir bir kaynak bulmak gerçekten çok zordu. Sonunda tüm teknik detayları inceleyip sistemi test ettim. En sonunda doğru adrese ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet yukle android 1xbet yukle android. Valla bak net söyleyeyim — android kullanıcıları için biçilmiş kaftan diyebilirim.

    güncellemeleri de düzenli geliyor gerçekten. Birçok uygulama denedim ama bunda karar kıldım — başka yerde vakit kaybetmeyin yani. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  26. 1xbet apk_afKl

    Android kullanıcısı olarak iyi bir uygulama şart. Play Store’da arattım ama son sürümü bulamadım. En sonunda sağlam bir kaynağa ulaştım ve size de buradan bahsetmek istediğim nokta şurası: 1xbet mobil apk 1xbet mobil apk. Valla bak net söyleyeyim — telefonuma kurduktan sonra hiç şikayet etmedim.

    Hiçbir kasma yaşamadım şu ana kadar. Birçok apk denedim ama en iyisi bu çıktı — en güvenilir uygulama bu oldu artık. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  27. melbet_vjSi

    Слушайте, кто в курсе, долго сомневался до последнего, но недавно таки решил глянуть в melbet. Честно? теперь постоянно туда захожу. Особенно если вам надо скачать melbet на андроид — у меня модель достаточно бюджетная, но приложение работает плавно.

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

    Reply
  28. KalebFip

    Felt slightly impressed without being able to point to one specific reason, and a look at buildyourvisionpath 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
  29. 1xbet apk_caPl

    Uzun süredir mobil bahis için doğru uygulamayı arıyordum. Play Store’da resmi uygulama yok diye duydum. En sonunda güvendiğim bir kaynağa ulaştım ve size de buradan bahsetmek istediğim nokta şurası: 1xbet apk son sürüm 1xbet apk son sürüm. Yani anlatmak istediğim şu — mobil versiyonu masaüstüyle yarışır kalitede.

    Hiçbir hata almadım şu ana kadar. Birçok apk denedim ama en stabilı bu çıktı — en güvenilir uygulama bu oldu artık. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  30. TaylorRaw

    Got pulled in by the headline and stayed because the content actually delivered on the promise, and a stop at claritycreatesresults kept that trust intact, when a site lives up to its own framing it earns the right to keep showing up in my browser tabs going forward indefinitely from here on out really.

    Reply
  31. melbet_jeen

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

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

    Reply
  32. KaiPug

    Skimmed first and then went back to read carefully, and the careful read paid off in places I had missed, and a stop at gladeharbormarkethall got the same treatment, the rare site whose content rewards a second pass is content I want more of in my regular rotation rather than disposable single read articles.

    Reply
  33. vivod iz zapoya v stacionare_gxEr

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

    Reply
  34. EarlSmeft

    Looking for similar voices elsewhere has come up empty in my recent searches, and a stop at auroracoveartisanexchange extended the search frustration, the rare site that does what no other does in quite the same way is precious and this one has clearly developed a particular approach that I have not been able to find duplicates of.

    Reply
  35. Kalebvitle

    Worth saying that the prose reads naturally without straining for style, and a stop at echobrookcraftcollective maintained the same unforced quality, writing that achieves elegance without effort is the highest tier and this site has clearly worked out how to land that effortless quality consistently rather than only on the writers best days.

    Reply
  36. Alecdix

    Now feeling the small relief of finding writing that does not condescend, and a stop at startwithclearfocusnow extended that respect for readers, content that treats its audience as capable adults rather than as people to be managed produces a different reading experience and this site has clearly chosen the respectful approach across all pieces.

    Reply
  37. Dominicmuh

    Felt the post handled a sensitive angle of the topic with appropriate care, and a look at kinmuzo extended that careful handling across related material, sites that can navigate delicate territory without causing damage are rare and require a level of judgement that comes from experience rather than from following any clear playbook.

    Reply
  38. Cecilbiz

    Now wishing I had found this site sooner, and a look at coralmeadowcommercegallery extended that mild regret, the calculation of how many years of good content I missed by not finding the right sources earlier is one I try not to make too often but it does come up sometimes when I find sites this good.

    Reply
  39. Ivanseelf

    Easily one of the better explanations I have read on the topic, and a stop at snowcoveartisanexchange pushed it even higher in my mental ranking of useful resources, the kind of site that beats the average not by trying harder but by simply caring more about what it puts out daily which always shows.

    Reply
  40. Quincybug

    Bookmark earned, share earned, return visit earned, all from one reading session, and a look at palmcodex did the same, the trifecta of bookmark and share and return is rare in a single visit and represents the highest level of engagement I tend to offer any piece of online content these days here.

    Reply
  41. melbet_qlSl

    Народ, привет! долго откладывал этот момент до последнего, но на днях все-таки зарегился ради интереса в melbet. Скажу так — очень зашло с первых минут,. У кого обычный андроид — всё четко и стабильно работает. Надо melbet скачать на андроид? За пять минут софт поставил на смарт,.

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

    Reply
  42. RandallKaw

    Worth pointing out the careful word choice in this post, no buzzwords and no jargon, and a look at draftglade 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
  43. 1xbet apk_crPl

    Uzun süredir mobil bahis için doğru uygulamayı arıyordum. Virüssüz bir apk bulmak gerçekten çileydi valla. En sonunda güvendiğim bir kaynağa ulaştım ve size de buradan bahsetmek istediğim nokta şurası: 1xbet android uygulama 1xbet android uygulama. Valla bak net söyleyeyim — android uygulaması resmen harika çalışıyor.

    yüklemesi de iki dakikadan az sürdü yani rahat olun. Kendi deneyimlerimi aktarıyorum size — en güvenilir uygulama bu oldu artık. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  44. 1xbet apk_ekPl

    Telefonuma güvenle yükleyebileceğim bir apk bulmak istiyordum. Play Store’da resmi uygulama yok diye duydum. En sonunda güvendiğim bir kaynağa ulaştım ve size de buradan bahsetmek istediğim nokta şurası: 1xbet app apk 1xbet app apk. Yani anlatmak istediğim şu — telefonuma indirince kasma sorunu tamamen bitti.

    boyutu da hafif gerçekten şaşırdım. Kendi deneyimlerimi aktarıyorum size — başka yerde vakit kaybetmeyin yani. Umarım siz de memnun kalırsınız…

    Reply

Leave a Reply

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