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

  1. Narkolog na dom_dmon

    Случается, когда уже не до раздумий — родственник в запое , а везти в больницу просто нереально . Моя семья такое пережила пару лет назад . Сидишь, не знаешь что делать . Начинаешь обзванивать знакомых , а вокруг бабло тянут. Пока кто-то не подсказал один реально работающий вариант. Требуется срочная помощь — а везти самому просто нереально, то нужно вызывать врача на дом. Речь конкретно про круглосуточный выезд нарколога. У нас в Самаре, если честно, тоже полно левых контор без лицензии. Нормальные контакты, кто реально приезжает ниже по ссылке: врач нарколог на дому https://narkolog-na-dom-samara-13.ru Честно скажу , после того как вник в детали, многое прояснилось . Там и про капельницы подробно , и про последующее кодирование. И цены адекватные, без разводов. Советую не откладывать.

    Reply
  2. Narkolog na dom_lton

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

    Reply
  3. 1xbet apk_nupn

    Android telefonumda rahatça oynamak istiyordum. Herkes farklı bir şey öneriyordu kafam allak bullak oldu. Güncel bilgileri kontrol edip süreci hatasız başlattım. En sonunda doğru adrese ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet apk 1xbet apk. Şimdi size kısaca özet geçeyim — mobil versiyonu bile çok akıcı aslında.

    Hiçbir gecikme yaşamadım şu ana kadar. Kendi deneyimlerimi aktarıyorum size — en sorunsuz çalışan uygulama bu oldu artık. Umarım siz de memnun kalırsınız…

    Reply
  4. 1xbet apk_oypn

    Uygulama arayışım epey uzun sürdü valla. Güvenilir bir kaynak bulmak gerçekten çok zordu. Güncel bilgileri kontrol edip süreci hatasız başlattım. En sonunda doğru adrese ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet mobil apk 1xbet mobil apk. Yani anlatmak istediğim şu — android kullanıcıları için biçilmiş kaftan diyebilirim.

    Hiçbir gecikme yaşamadım şu ana kadar. İşin doğrusunu söylemek gerekirse — en sorunsuz çalışan uygulama bu oldu artık. Umarım siz de memnun kalırsınız…

    Reply
  5. ClydeLob

    Granted I am giving this site more credit than I usually give new finds, and a look at finkglint continued earning that credit, the calibration of how much trust to extend after limited exposure is something I do carefully and this site has earned more trust on shorter exposure than most due to consistent quality across.

    Reply
  6. FelixSpazy

    Worth flagging that this approach to the topic is fresh without being contrarian, and a stop at pacecabin extended the same fresh angle, finding original perspective on familiar subjects is rare and this site has clearly developed its own way of seeing rather than echoing the dominant takes from elsewhere consistently.

    Reply
  7. Caindot

    Anyone curious about this topic would do well to start here, the foundation laid is solid, and a stop at oakarenas would round out their understanding nicely, this is the kind of resource I would point a friend toward without hesitation if they asked me where to begin learning about anything in this area.

    Reply
  8. LucasWarce

    Came across this looking for something else entirely and ended up reading it through twice, and a look at kilzavo pulled me deeper into the site than I planned, the writing has a way of holding attention without resorting to manipulative cliffhangers or vague promises that never get delivered later down the page.

    Reply
  9. EthanSmers

    A piece that exhibited the kind of patience that good writing requires, and a look at startpurposeledgrowth 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
  10. SamRiz

    Quietly impressive in a way that does not announce itself, and a stop at explorefuturefocusedideas extended that quiet impressiveness, the kind of quality that emerges through sustained attention rather than first impressions is the kind I trust more deeply and this site has been earning that deeper trust across multiple sessions over time consistently.

    Reply
  11. Alecneice

    Now realising the post has been quietly doing important work in my mind for the past hour, and a stop at explorefreshopportunitypaths extended that quiet processing, content that continues to do work after I close the tab is content with afterlife in the mind and this site is producing those long lived effects at a meaningful rate.

    Reply
  12. melbet_bdSi

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

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

    Reply
  13. Lukeneigo

    Really like the way the post resists reaching for cliches that would have made it feel generic, and a quick visit to coralharbormerchantgallery kept that fresh feel going, original phrasing and unexpected metaphors are signs that the writer is actually thinking rather than just stitching together familiar phrases into the appearance of content.

    Reply
  14. Marcusrurgy

    Quality writing that respects the reader’s intelligence without overloading them, and a quick look at violetharbortradeparlor reflected that approach, a balanced thoughtful site that earns trust by being consistent rather than by shouting about how trustworthy it is which is the usual approach online sadly across most content categories.

    Reply
  15. TrevorDaw

    Solid endorsement from me, the writing earns it, and a look at thinkingintosystems continues to earn it across the broader site too, the kind of operation that maintains quality across many pages rather than just one viral post is a sign of serious commitment and that is what I see here clearly across what I read.

    Reply
  16. melbet_dyen

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

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

    Reply
  17. 1xbet apk_zdpt

    Mobil bahise merak salalı çok oldu valla. Play Store’da bulamayınca ne yapacağımı bilemedim. Adımları doğru sırayla uyguladıktan sonra erişim sorunsuz açıldı. En sonunda doğru adrese ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet download android 1xbet download android. Yani anlatmak istediğim şu — mobil uygulaması inanılmaz akıcı aslında.

    kurulumu da üç dakikadan kısa sürdü yani rahat olun. Birçok apk denedim ama bunda karar kıldım — başka yerde vakit kaybetmeyin yani. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  18. RaulIcete

    I usually skim posts like these but this one held my attention all the way through, and a stop at gingerwoodgoodsroom 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
  19. 1xbet apk_yeel

    Telefonumdan rahatça bahis oynayabileceğim bir uygulama lazımdı. Play Store’da arattım ama resmi olanı bulamadım. En sonunda doğru kaynağa ulaştım ve size de buradan bahsetmek istediğim nokta şurası: 1xbet android uygulama 1xbet android uygulama. Şimdi size kısaca özet geçeyim — mobil sürümü gerçekten masaüstünü aratmıyor.

    güncellemeleri otomatik yapıyor çok memnunum. Birçok apk denedim ama en sorunsuzu bu çıktı — kesinlikle pişman olmazsınız deneyin derim. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  20. CalebDes

    Picked this up while looking for something else and ended up reading every paragraph because it was actually informative, and after epicinlet I was sure I would come back, that does not happen often when most sites bury the useful parts under endless ads and pop ups today and across most categories online.

    Reply
  21. 1xbet apk_gcPl

    Uzun süredir mobil bahis için doğru uygulamayı arıyordum. 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 android 1xbet android. Valla bak net söyleyeyim — mobil versiyonu masaüstüyle yarışır kalitede.

    yüklemesi de iki dakikadan az sürdü yani rahat olun. Birçok apk denedim ama en stabilı bu çıktı — en güvenilir uygulama bu oldu artık. Herkese hayırlı olsun…

    Reply
  22. Josiahblort

    Reading this triggered a small but real correction in something I had assumed, and a stop at elveglide extended that corrective effect, content that updates my beliefs through evidence rather than rhetoric is content with intellectual integrity and this site has earned that label consistently across the pieces I have read so far today.

    Reply
  23. IraViole

    Just want to acknowledge that the writing here is doing something right, and a quick visit to echobrookartisanexchange confirmed the same standards run across the broader site, recognising good work is something I try to do when I find it because the alternative is silence and silence rewards mediocrity.

    Reply
  24. LucasWarce

    A piece that reads like it was written for me without claiming to be written for me, and a look at kilzavo produced the same fit, when the writer audience match clicks naturally without being engineered through demographic targeting you know the writing is solid and this site has that natural fit consistently for me.

    Reply
  25. DerrickTiT

    A thoughtful piece that did not strain to be thoughtful, and a look at domemarina continued that effortless quality, when thinking shows up in writing without the writer drawing attention to it you know you are reading something genuinely considered rather than something performing the appearance of consideration which is also common online.

    Reply
  26. melbet_bsSl

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

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

    Reply
  27. TraceDiree

    Liked the way the post balanced confidence and humility, and a stop at skyharborartisanexchange maintained the same balance, knowing when to assert and when to acknowledge uncertainty is a sign of mature thinking and the writers here have clearly developed that calibration through what I assume is years of careful work on their craft.

    Reply
  28. Alecneice

    Worth flagging that the writing rewarded a second read more than I expected, and a look at explorefreshopportunitypaths produced the same second read benefit, content with hidden depths that emerge only on careful rereading is rare in the modern blog space and this site has clearly invested in that level of compositional density throughout.

    Reply
  29. melbet_ouSi

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

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

    Reply
  30. melbet_fcen

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

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

    Reply
  31. luxury car rental miami_epkn

    Finding a proper ride in this city is a serious challenge. I swear half the “luxury” fleets down here are straight-up marketing scams. You book a premium ride online, arrive all excited, then boom — hidden service fees everywhere. I’ve been burned like three times already this year alone. If you seriously need a legit vehicle to cruise around the city, do some real digging first and read actual customer reviews. 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, but I eventually found a service with no bait, no switch, and no weird fine print. If you are looking for the only straight shooter for premium rentals across South Florida, check the details here: miami beach luxury car rental miami beach luxury car rental. 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
  32. Marcusrurgy

    Quality writing that respects the reader’s intelligence without overloading them, and a quick look at violetharbortradeparlor reflected that approach, a balanced thoughtful site that earns trust by being consistent rather than by shouting about how trustworthy it is which is the usual approach online sadly across most content categories.

    Reply
  33. MurrayinciP

    Reading this prompted me to dig out an old reference book related to the topic, and a stop at dewdawns 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. EmilioDom

    Glad the writer kept this short rather than padding it out, the points stand on their own without needing extra context, and a look at explorestrategicgrowthideas kept the same approach going, brevity is a sign of confidence in the substance and the team here clearly trusts their content to land without filler.

    Reply
  35. KelbyHeelp

    Worth a quiet moment of recognition for the consistency I have noticed across multiple posts, and a stop at jetdome 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
  36. Harlanactip

    Appreciated that the writer trusted the reader to follow along without constant restating of earlier points, and a look at pactcliff continued that respect for the reader, treating an audience as capable adults rather than as people to be hand held through every paragraph is something I notice and value highly across the open internet today.

    Reply
  37. Lukeneigo

    If the topic interests you at all this is a place to spend time, and a look at coralharbormerchantgallery reinforced that recommendation, the broader question of where to invest topical reading time is one this site answers convincingly through the consistent quality across multiple pieces I have sampled during the current reading session today.

    Reply
  38. IraViole

    Reading this in the time it took to drink half a cup of coffee, and a stop at echobrookartisanexchange fit naturally into the second half, content that respects the rhythms of a typical morning is content with practical fit and this site has the kind of length and pacing that works for the way I actually read.

    Reply
  39. luxury car rental miami_kckn

    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. I’ve been burned like three times already this year alone. 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.

    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: exotic car rental miami beach fl exotic car rental miami beach fl. Yeah, valet in Miami Beach will cost you an arm, but that’s not their fault. Anyway, glad there’s at least one honest rental joint left in this town, let me know if you guys have any other clean spots.

    Reply
  40. melbet_fqSl

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

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

    Reply
  41. DerrickTiT

    Now considering whether the post would translate well into a different form, and a look at domemarina suggested similar versatility, content that could move into other media without losing its substance is content that has been built around ideas rather than around format and this site reads as idea first throughout posts.

    Reply
  42. RaulIcete

    Reading this in a relaxed evening setting was a small pleasure, and a stop at gingerwoodgoodsroom extended the pleasant evening reading, content that fits the tone of relaxed time without becoming forgettable is what I look for in evening reading and this site has the right tone for that particular slot in my daily reading routine.

    Reply
  43. Russellnam

    Информационный автопортал https://autoinfo.kyiv.ua для водителей и автолюбителей. Обзоры автомобилей, новости производителей, рекомендации по уходу за машиной, выбору запчастей и безопасной эксплуатации транспортных средств.

    Reply
  44. Williamcox

    Honestly impressed by the consistency of voice across what I have read so far, and a quick visit to firminlet continued that consistent feel, when a site reads like one careful person rather than a committee the experience is more rewarding for the reader who notices these subtle editorial details over time.

    Reply
  45. Danielmus

    Полезный ресурс https://rkas.org.ua о ремонте и строительстве для тех, кто хочет создать комфортное и надежное жилье. Инструкции, экспертные советы, обзоры строительных материалов и практический опыт специалистов.

    Reply
  46. JustinHar

    Строительный интернет-портал https://esi.com.ua с полезной информацией для владельцев недвижимости, строителей и ремонтных специалистов. Инструкции, обзоры материалов, советы экспертов и новости строительной отрасли.

    Reply
  47. TrevorFossy

    Ремонт и строительство https://mramor.net.ua без лишних затрат. Обзоры материалов, строительных решений, технологий и оборудования. Практические советы помогут грамотно спланировать работы и получить качественный результат.

    Reply
  48. TraceDiree

    Most blog writing on this subject reaches for the same handful of arguments and this post avoided them, and a look at skyharborartisanexchange continued the original treatment, content that finds its own path through territory other writers have flattened is content with real authorial energy and this site has plenty of that distinctive energy.

    Reply

Leave a Reply

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