拖了一个月终于着手并且完成了。其实没有什么难的。但是因为我对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是傻瓜操作,没有怎么弄?这个我也弄了好半天最终解决了,马上再写一篇单独说吧
好啦好啦,到此结束,路人有问题可以在下面留言~
Reading this gave me a quiet moment of intellectual pleasure that I had not been expecting, and a stop at prairievendor extended that pleasure across more pages, the unexpected reward of stumbling into careful writing is one of the small ongoing pleasures of reading the open web and this site is delivering it reliably.
Refreshing change from the usual sites covering this topic, no clickbait and no padding, and a stop at ardenbeach confirmed the difference, this place clearly has its own voice rather than copying the formulas everyone else uses to chase clicks online which is becoming increasingly rare these days across nearly every popular subject.
The use of plain language without dumbing down the topic was really well done, and a look at cantclap 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.
Came here from a search and stayed for the side links because they were that interesting, and a stop at globaldesignmarketplace took me even further into the site, the kind of organic exploration that good content invites is something most sites kill through aggressive interlinking and pushy navigation choices rather than relying on quality.
Strong recommendation, anyone interested in this topic owes themselves a visit, and a stop at auralbrig extends that recommendation across more of the site, this is the kind of resource that makes me more optimistic about the state of the open web than I usually am these days actually for once which is genuinely refreshing.
Closed several other tabs to focus on this one as I read, and a stop at pebblevendor held my undivided attention the same way, content that earns full focus in an attention environment full of competing pulls is content doing something genuinely well and the team behind it deserves recognition for that achievement consistently.
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 carefullycuratedfinds 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.
Reading this gave me something to think about for the rest of the afternoon, and after berylbuff I had even more to mull over, the kind of post that lingers in the background of your day rather than evaporating immediately is genuinely valuable in an attention economy that punishes depth rather than rewarding it.
Recommended to anyone working in or curious about this area, the depth and clarity combine well, and a look at prairievendor keeps that going across more pages, the kind of site that earns regular visits rather than chasing trends has my respect because it suggests genuine commitment to the topic itself rather than to chasing trends.
Started reading and ended an hour later without realising the time had passed, and a look at boundcling produced the same time dilation effect, when content makes time feel different the writer has achieved something well beyond the average and this site is producing that experience for me reliably across multiple readings.
Just want to acknowledge that the writing here is doing something right, and a quick visit to civicbrisk 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.
Genuinely glad I clicked through to read this rather than skipping past, and a stop at timbervendor confirmed I should keep clicking through to more pages here, the kind of resource that justifies its place in my browser history rather than feeling like wasted time which is the highest compliment I offer any site online today.
Genuine reaction is that I will probably think about this on and off for a few days, and a look at ethicalmodernmarketplace 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.
Worth pointing out the careful word choice in this post, no buzzwords and no jargon, and a look at pebblevendor 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.
Bookmarked the page and the homepage too because clearly there is more to explore here, and a quick stop at compassbulb only made that more obvious, this is the kind of place I want to dig through over a weekend rather than rushing through during a coffee break tomorrow morning before getting back to work.
Genuinely good work, the kind that holds up over multiple readings without losing its appeal, and a stop at crestbulb kept that going, definitely a site I will be returning to and probably mentioning to others who work in or care about this particular area of interest today and in coming weeks.
Glad I gave this a chance instead of bouncing on the headline, and after berylbuff I was certain I had made the right call, snap judgements based on titles miss a lot of good content and this is a reminder to slow down and check things out before scrolling past in a hurry.
Now feeling something close to gratitude for the fact this site exists, and a look at ardenbrisk extended that gratitude, the rare site that produces this kind of response is the rare site worth defending in conversations about whether the modern internet is still capable of producing genuinely valuable independent content for serious adults.
Reading this prompted a small note in my reference file, and a stop at timbervendor prompted another, the rare site that contributes useful nuggets to my own working knowledge rather than just consuming my attention is worth the time investment many times over compared to the usual pile of forgettable scroll content.
A memorable post for me on a topic I had thought I was tired of, and a look at creativecommercecollective suggested the same site can refresh other tired topics, sites that can revive my interest in subjects I had written off as exhausted are doing rare work and this one is clearly doing that for me today.
Just sat back at the end of the post and felt grateful that someone took the time to write it, and a look at ethicalmodernmarketplace extended that gratitude across more of the site, recognising effort behind quality work is part of what makes the open web a community rather than just a marketplace today.
Came in skeptical and left mostly convinced, that is the highest praise I can offer, and a look at capeasana pushed me further in the same direction, content that survives a critical first read is rare and worth recognising because most blog posts crumble under any real scrutiny these days when you actually pay attention closely.
Coming back tomorrow when I can give this a proper read, the post deserves better attention than I can give right now, and a look at crestbulb suggests there is plenty more here that deserves the same treatment, definitely a site I will be exploring properly over the next few days when I can.
A piece that did not waste any of its substance on sales or promotion, and a look at ardenbrisk continued that pure content focus, sites that resist the urge to monetise every paragraph are increasingly rare and this one has clearly made the editorial choice to keep the writing clean from commercial intrusion which I value highly.
Looking at the surface design and the substance together this site has both right, and a look at everydaypremiumessentials reinforced that integrated quality, sites where presentation and content reinforce each other rather than fighting are sites with full editorial coherence and this one has clearly invested in both layers in a balanced way.
Honestly thank you to whoever wrote this because it scratched an itch I had not quite been able to articulate, and a stop at compassbulb kept that satisfying feeling going, the kind of writing that meets unspoken needs is special and this site clearly has writers who understand their readers more than most do today.
Now adjusting my mental model of how the topic fits into the broader landscape, and a look at auralcleat extended that adjustment, content that affects my structural understanding rather than just my factual knowledge is content with deeper impact and this site is providing those structural updates at a meaningful rate consistently across topics.
Decided not to comment because the post said what needed saying, and a stop at creativecommercecollective continued that complete feel, content that does not invite obvious additions or corrections from readers is content that has been carefully considered and this site appears to consistently produce pieces that satisfy rather than provoke unnecessary follow ups.
A piece that handled multiple complications without becoming confused, and a look at larkvendor continued that organisational clarity, holding multiple threads in a single piece without losing any of them is a sign of skilled writing and this site has clearly developed the editorial discipline to manage complexity without sacrificing readability throughout.
Easily one of the better explanations I have read on the topic, and a stop at silkvendor 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.
Probably worth setting aside a longer block to read more carefully than I can right now, and a stop at berylcalm confirmed the longer block plan, the impulse to schedule dedicated time for a sites archive is itself a measure of trust and this site has earned that scheduling impulse from me clearly today actually.
Reading this prompted a small redirection in something I was working on, and a stop at boundcoil 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.
Came away with a slightly better mental model of the topic than I started with, and a stop at valuewhisper sharpened that further, content that improves the reader thinking apparatus rather than just dumping facts into it is the rare kind I genuinely value and seek out when I have time to read carefully.
A piece that did not waste any of its substance on sales or promotion, and a look at everydaypremiumessentials continued that pure content focus, sites that resist the urge to monetise every paragraph are increasingly rare and this one has clearly made the editorial choice to keep the writing clean from commercial intrusion which I value highly.
Came away with a small but real shift in perspective on the topic, and a stop at intentionalmarketplacehub pushed that shift a bit further, the kind of subtle reframing that good writing does to a reader without making a big deal of it is something I always appreciate when it happens which is sadly not that often.
A piece that handled multiple complications without becoming confused, and a look at larkvendor continued that organisational clarity, holding multiple threads in a single piece without losing any of them is a sign of skilled writing and this site has clearly developed the editorial discipline to manage complexity without sacrificing readability throughout.
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 silkvendor 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.
Compared to the usual results for this kind of search this site stands well above the average, and a quick visit to auralcleat 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.
Worth recognising the specific care that went into how this post ended, and a look at ardenburst maintained the same careful conclusions, endings are where most blog content falls apart and this site has clearly invested in the closing stretches of its pieces rather than letting them simply trail off when energy fades.
Generally I bookmark sparingly to avoid building up a bookmark graveyard but this one earned a permanent slot, and a stop at berylcalm extended that permanence designation, the few sites I keep permanent bookmarks for are sites I expect to use repeatedly and this one has clearly cleared that expectation bar today.
Found the writing surprisingly fresh for what is by now a well covered topic, and a stop at crocboard 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.
After several visits I am now confident this site is one to follow seriously, and a stop at valuewhisper reinforced that confidence, the gradual building of trust through repeated quality exposures is the only sustainable way to develop reader loyalty and this site is building that loyalty in me through patient consistent work consistently.
Well done, the kind of post that makes you slow down and actually read instead of skimming for keywords, and a look at civiccask kept me reading carefully too, that is a sign of writing that has been crafted rather than churned out for an algorithm to see today and tomorrow.
Closed the tab and immediately reopened it ten minutes later because I wanted to reread a part, and a stop at thoughtfullyselectedproducts drew the same return, content that pulls you back after closing it is doing something well beyond the average and worth marking as exceptional in my mental catalogue of reliable sites.
Found this really helpful, the explanations are simple but they actually answer the questions a normal reader would have, and after I followed boundcoil I had a clearer sense of the topic, no extra fluff just useful points laid out in a sensible order that made the time worth it.
Really thankful for posts that respect a reader’s time, this one does, and a quick look at intentionalmarketplacehub was the same, no need to scroll through endless intros just to get to the actual content, that approach alone is enough reason to come back here regularly for the kind of writing offered.
Granted my mood today might be elevating my reading experience but I still think this is genuinely good, and a stop at ardenburst reinforced that even discounted assessment, controlling for the mood adjustment that affects content perception this site still reads as substantively above average across multiple pieces I have read carefully today.
Strong recommendation from me, anyone curious about the topic should make time for this, and a look at crocboard only sharpens that recommendation further, the kind of resource that holds up against careful scrutiny rather than crumbling at the first critical question is rare and worth pointing other people toward when the topic comes up.
Skipped the related products section because there was none, and a stop at compasscabin also lacked any aggressive monetisation, content that is not constantly trying to convert me into a customer or subscriber is content that has confidence in its own value and that confidence shows up as a different reading experience.
A genuine compliment to the writer for keeping the post focused on what mattered, and a look at thoughtfullyselectedproducts 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.