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

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

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

  1. luxury car rental miami_vqKt

    Alright, real talk about the Miami rental game — it’s a straight-up jungle out here. Then you show up at the local lot to pick up the car. Different car waiting — scratches everywhere, smells like an ashtray, and that “amazing price”? Doesn’t include the mandatory $400 cleaning fee or the $30 per day toll pass you can’t waive. Eight years in South Florida and these clowns still almost get me. When you need a proper and reliable premium ride to cruise around, do some real digging first and read actual customer reviews. Anyone who’s waited for an Uber in August understands exactly what I mean about this city, whether you are doing South of Fifth brunch, Design District shopping, or a spontaneous Keys trip.

    Most of these local agencies are just shiny websites hiding the same beat-up fleet with fake reviews, but I eventually found a service where what you book is exactly what shows up, no surprises, no fine print nightmares. If you are looking for the only honest source for premium wheels across South Florida, check the current details here: benz for rent https://luxury-car-rental-miami-8.com. Also, definitely bring serious shades unless you enjoy driving straight into the sun like a zombie every single evening. Anyway, glad there’s at least one straight operator left in this rental circus, let me know if you guys have any other clean spots.

    Reply
  2. Timmyflade

    High quality writing, no marketing speak and no buzzwords that mean nothing, and a stop at gildedgrovegoodsroom kept that going, simple direct content that actually communicates something is harder to find than it should be and this is one of the rare places that gets it right consistently across many different posts.

    Reply
  3. 1xbet indir_jvml

    Android için güncel sürümü bulmak epey meşakkatliydi açıkçası. Play Store’da resmi olanı bulamayınca çok şaşırdım. Güncel bilgileri kontrol edip süreci hatasız başlattım. En sonunda güvenilir bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet mobil uygulama 1xbet mobil uygulama. Yani anlatmak istediğim şu — son sürümü tüm beklentileri karşılıyor resmen.

    Hiçbir sorun yaşamadım indirme işleminde. İşin doğrusunu söylemek gerekirse — en kullanışlı uygulama bu oldu artık. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  4. Aidannes

    Thank you for not assuming the reader already knows everything, the explanations meet me where I am, and a look at fastgoodscorner did the same, that consideration is what makes a site feel welcoming rather than gatekeepy which is sadly the default mood across the modern web today for most subjects covered.

    Reply
  5. Destinroulk

    Now considering carefully how to share this site with the right audience rather than broadcasting widely, and a look at directionbuildsconfidence extended that careful sharing impulse, content worth sharing carefully rather than spamming is content that has earned a higher kind of recommendation and this site has earned that careful shareability throughout pieces.

    Reply
  6. 1xbet indir_vnki

    1xbet indir işlemini nasıl yapacağımı çok araştırdım valla. Play Store’da resmi olanı bulamayınca çok hayal kırıklığı yaşadım. Sonunda tüm teknik detayları inceleyip sistemi test ettim. En sonunda güvendiğim bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet mobile yukle 1xbet mobile yukle. Yani anlatmak istediğim şu — telefonuma indirdikten sonra çok memnun kaldım.

    güncellemeleri de düzenli olarak yapılıyor. İşin doğrusunu söylemek gerekirse — kesinlikle pişman olmazsınız deneyin derim. Herkese hayırlı olsun…

    Reply
  7. 1xbet indir_tuki

    Telefonuma son sürümü yüklemek istiyordum açıkçası. Herkes farklı bir link paylaşıyordu kime güveneceğimi şaşırdım. Sonunda tüm teknik detayları inceleyip sistemi test ettim. En sonunda güvendiğim bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet mobil indir 1xbet mobil indir. Valla bak net söyleyeyim — son sürümü tüm eksiklikleri gidermiş resmen.

    Hiçbir hata almadım indirme esnasında. İşin doğrusunu söylemek gerekirse — en sağlam uygulama bu oldu artık. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  8. 1xbet indir_scMl

    Telefonuma 1xbet yüklemek istiyordum ama nasıl yapacağımı bilmiyordum. Herkes farklı bir adres söylüyordu kime güveneceğimi şaşırdım. Güncel bilgileri kontrol edip süreci hatasız başlattım. En sonunda güvenilir bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: xbet indir xbet indir. Valla bak net söyleyeyim — mobil uygulaması inanılmaz kullanışlı çalışıyor.

    Hiçbir sorun yaşamadım indirme işleminde. Kendi deneyimlerimi aktarıyorum size — kesinlikle pişman olmazsınız deneyin derim. Herkese hayırlı olsun…

    Reply
  9. 1xbet indir_mhMl

    Telefonuma 1xbet yüklemek istiyordum ama nasıl yapacağımı bilmiyordum. Play Store’da resmi uygulamayı bulamayınca çok üzüldüm. Sonunda tüm teknik detayları inceleyip sistemi test ettim. En sonunda güvenilir bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet indir tr canli bahis site 1xbet indir tr canli bahis site. Valla bak net söyleyeyim — telefonuma indirdikten sonra çok mutlu oldum.

    güncellemeleri otomatik yapıyor çok memnunum. Birçok platform denedim ama en iyisi bu çıktı — kesinlikle pişman olmazsınız deneyin derim. Herkese hayırlı olsun…

    Reply
  10. Rickyhorne

    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 progressoverperfection 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
  11. Terrelllyday

    Reading this prompted a small redirection in something I was working on, and a stop at directioncreatestraction extended that redirecting influence, content that affects my actual work rather than just my thinking has the highest practical impact and this site is providing that level of influence for me at a sustainable rate apparently.

    Reply
  12. JoelDuh

    Honestly enjoyed every minute spent here, that is not something I say lightly, and a look at executeideasnow confirmed I will be back, the bar for spending time online is high for me these days but this site clears it without effort which is high praise indeed from this reader who is usually rather demanding.

    Reply
  13. 1xbet indir_eaKn

    1xbet indir işlemini nasıl yapacağımı çok merak ediyordum. Play Store’da resmi olanı bulamayınca çok hayal kırıklığı yaşadım. Sonunda tüm teknik detayları inceleyip sistemi test ettim. En sonunda güvendiğim bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet mobil yükle 1xbet mobil yükle. Valla bak net söyleyeyim — son sürümü tüm ihtiyaçları karşılıyor resmen.

    Hiçbir sıkıntı yaşamadım indirme esnasında. Birçok platform denedim ama en iyisi bu çıktı — kesinlikle pişman olmazsınız deneyin derim. Umarım siz de memnun kalırsınız…

    Reply
  14. ArmandoTup

    Better than most of the writing I have come across on this topic recently, simpler and more direct, and a look at kettlecrestmarkethouse continued in that same way, a real outlier in a crowded space full of repetitive content that says little while taking up a lot of reader time today which is unfortunate.

    Reply
  15. Johnniegen

    Came across this and immediately thought of a friend who would enjoy it, and a stop at directiondrivesexecution also reminded me of someone, content that triggers the urge to share is content that has earned my recommendation and this site has earned multiple from me already across different conversations during the week.

    Reply
  16. Adamscano

    Yesterday I was complaining about the state of online writing and today this site has temporarily fixed that complaint, and a look at birchharbormerchantgallery extended that mood reversal, the short term mood improvement that comes from finding good content is real and this site has produced that improvement for me at a useful moment.

    Reply
  17. MitchellMed

    Reading the writers other posts after this one suggests the quality is consistent rather than peak, and a stop at focusarchitecture confirmed the consistent quality reading, sites that hold the same level across many pieces rather than peaking on a few are sites with sustainable editorial discipline and this one has clearly developed that.

    Reply
  18. Armandolenny

    A particular kind of restraint shows up in the writing, and a look at claritydrivenmovement maintained the same restraint across pages, knowing what not to say is just as important as knowing what to say and this site has clearly developed strong instincts on both sides of that editorial line throughout pieces I have read.

    Reply
  19. 1xbet indir_olen

    1xbet indir işlemini nasıl yapacağımı çok merak ediyordum valla. Play Store’da resmi olanı bulamayınca çok şaşırdım. Güncel bilgileri kontrol edip süreci hatasız başlattım. En sonunda güvenilir bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: xbet indir xbet indir. Şimdi size kısaca özet geçeyim — telefonuma indirdikten sonra çok memnun kaldım.

    kurulumu da çok basit ve anlaşılırdı yani rahat olun. Birçok platform denedim ama en iyisi bu çıktı — başka yerde vakit kaybetmeyin yani. Umarım siz de memnun kalırsınız…

    Reply
  20. 1xbet indir_loen

    Telefonuma güncel versiyonu yüklemek istiyordum açıkçası. Play Store’da resmi olanı bulamayınca çok şaşırdım. Güncel bilgileri kontrol edip süreci hatasız başlattım. En sonunda güvenilir bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet mobil uygulama 1xbet mobil uygulama. Şimdi size kısaca özet geçeyim — mobil uygulaması gerçekten akıcı ve hızlı çalışıyor.

    Hiçbir sorun yaşamadım indirme işleminde. Birçok platform denedim ama en iyisi bu çıktı — kesinlikle pişman olmazsınız deneyin derim. Şimdiden iyi şanslar ve bol kazançlar…

    Reply
  21. Malcolmpycle

    Pleasant surprise, the post delivered more than the headline promised, and a stop at caramelharborvendorhall continued that pattern of under promising and over delivering, the rarest combination on the modern web where most content does the opposite by promising the world and delivering thin recycled summaries instead each time you click on something interesting.

    Reply
  22. luxury car rental miami_cbKt

    Let me save you some serious time, learned this the hard way. You find this amazing deal online: brand new Beamer, unlimited miles, price that makes you smile. Different car waiting — scratches everywhere, smells like an ashtray, and that “amazing price”? Doesn’t include the mandatory $400 cleaning fee or the $30 per day toll pass you can’t waive. Eight years in South Florida and these clowns still almost get me. If you are trying to find a legitimate luxury fleet without getting ripped off, run far from the airport counters. Anyone who’s waited for an Uber in August understands exactly what I mean about this city, whether you are doing South of Fifth brunch, Design District shopping, or a spontaneous Keys trip.

    I’ve run through maybe 45 rental companies across Dade, Broward, and Monroe, until I finally found one outfit that doesn’t play stupid games. If you are looking for the only honest source for premium wheels across South Florida, check the current details here: premium car rental in miami premium car rental in miami. Also, definitely bring serious shades unless you enjoy driving straight into the sun like a zombie every single evening. Just drive safe out there and absolutely skip that “windshield protection” upsell — pure profit for them, zero value for you. hope this helps some of you save a few bucks.

    Reply
  23. Timmyflade

    A small thing but the line spacing and font choices made reading this physically pleasant, and a look at gildedgrovegoodsroom maintained the same careful design, technical choices about typography are part of what makes online reading actually comfortable and this site has clearly invested in the design layer alongside the content layer carefully.

    Reply
  24. Destinroulk

    Now adjusting my mental list of reliable sites for this topic, and a stop at directionbuildsconfidence reinforced the adjustment, the small ongoing curation work of maintaining trusted sources is one of the actual practical activities of careful reading and this site has earned a permanent place on my list for this particular subject.

    Reply
  25. SheldonDog

    Glad I stumbled across this post, the explanations actually make sense without needing background knowledge to follow along, and after a stop at purposefulmovement the same was true there, no assumptions about the reader just clear writing that anyone can understand from the first line right through to the end.

    Reply
  26. Rickyhorne

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

    Reply
  27. KingstonItani

    Reading this with a fresh mind in the morning brought out details I might have missed in the afternoon, and a stop at meadowharborgoodsroom earned the same fresh attention, content that rewards being read at full attention rather than at energy lows is content with real density and this site has that density consistently.

    Reply
  28. Andrewtum

    With Valorant Tracker http://www.valorant-fa.com/ you can learn about professional player settings, find the best aim, track ranks, and analyze match statistics. A useful tool for improving your skills and progressing more effectively in VALORANT.

    Reply
  29. AntonioHor

    The CS2 Pro http://www.counter-strike.ch/ portal features the latest Counter-Strike 2 news, live match results, tournament schedules, and analysis. Learn about professional scene events, team rankings, and the top stories from the world of CS2.

    Reply
  30. Javieradord

    A genuine compliment to the writer for keeping the post focused on what mattered, and a look at calmcovecraftcollective continued that disciplined focus, focus is a editorial choice that compounds across many small decisions and this site has clearly made those small decisions consistently across what I have read so far this week here.

    Reply
  31. 1xbet indir_rzml

    1xbet indir nasıl yapılır diye çok araştırdım valla. Herkes farklı bir şey tavsiye ediyordu kime güveneceğimi bilemedim. Sonunda tüm teknik detayları inceleyip sistemi test ettim. En sonunda güvenilir bir kaynağa ulaştım ve size de tüm detayları aktarmak istedim, güncel bilgilere buradan bakabilirsiniz: 1xbet güncelleme 1xbet güncelleme. Valla bak net söyleyeyim — mobil uygulaması inanılmaz hızlı ve stabil çalışıyor.

    kurulumu da oldukça basit ve anlaşılırdı yani rahat olun. İşin doğrusunu söylemek gerekirse — kesinlikle pişman olmazsınız deneyin derim. Herkese hayırlı olsun…

    Reply
  32. BillBiasp

    Now adding this to a list of sites I want to see flourish, and a stop at suncovevendorparlor reinforced that wish, the few sites I actively root for are sites that produce the kind of work I want more of in the world and this one has joined that small list based on what I have read so far.

    Reply

Leave a Reply

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