拖了一个月终于着手并且完成了。其实没有什么难的。但是因为我对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是傻瓜操作,没有怎么弄?这个我也弄了好半天最终解决了,马上再写一篇单独说吧
好啦好啦,到此结束,路人有问题可以在下面留言~
Well done, the writing is professional without being stiff, and the topic is treated with care, and a look at ampleclove 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.
Took the time to read every paragraph rather than skimming for the punchline, and a quick visit to merchglow earned the same careful attention from me, that is the highest signal I can give about content quality because my default mode is rapid scanning rather than deliberate reading on most pages.
займ без процентов на карту займ взять срочно на карту без отказа
Got pulled in by the headline and stayed because the content actually delivered on the promise, and a stop at amberbazaar 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.
Reading this gave me a small sense of progress on a topic I have been slowly working through, and a stop at kovique added another step forward, learning happens in small increments across many sources and finding sources that consistently contribute is the actual practical value of careful curation in an information rich world.
Came in skeptical and left mostly convinced, that is the highest praise I can offer, and a look at coltbrig 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.
Now sitting back and recognising that this was a small but real win in my reading day, and a stop at sustainabledesignstore extended that quiet win, the cumulative effect of small reading wins versus the cumulative effect of small reading losses is real over time and this site is contributing to the wins side of that ledger.
Picked this up while looking for something else and ended up reading every paragraph because it was actually informative, and after beigecanal 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.
Looking for similar voices elsewhere has come up empty in my recent searches, and a stop at auralbrick 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.
Felt like I was reading something written by someone who actually thinks about the topic rather than reciting it, and a look at contemporarydesignhub reinforced that impression, the difference between recited content and considered content is huge and this site clearly belongs to the latter category which I appreciate as a careful reader looking for substance.
Thank you for not assuming the reader already knows everything, the explanations meet me where I am, and a look at cipherbow 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.
A genuine compliment to the writer for keeping the post focused on what mattered, and a look at crazechip 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.
This actually answered the question I had been searching for, and after I checked kovique I had a few more pieces I had not realised I needed, that is the sign of a site that knows what its readers want before they even know how to ask it which is impressive.
Thanks for putting this online without locking it behind email signups or paywalls, and a quick visit to calmbyrd kept that open feel going, content that trusts the reader to come back rather than gating access is the kind of approach I will reward with regular return visits over time happily.
Felt the writer was being honest with the reader which is rare enough that I want to acknowledge it, and a look at beigecanal continued that honest feel, content built on actual knowledge rather than aggregated summaries is something I value highly and rarely come across in regular searches on the open internet these days.
If quality blog writing is dying as people sometimes claim then this site is one piece of evidence that it has not died yet, and a look at birchvista extended that evidence, the broader cultural question about online writing has empirical answers in specific sites and this one is contributing to a more optimistic answer overall.
Skipped the comments to avoid spoilers and came back later to find them genuinely worth reading, and a stop at androblink extended that surprised respect, when the discussion below a post matches the quality of the post itself you have found something special and this site appears to attract that kind of audience.
Picked a friend mentally as the audience for this and decided to send the link, and a look at boundcliff confirmed the send was the right choice, choosing whom to share content with is a small act of curation that I take more seriously than the public sharing most platforms encourage these days online.
Big thanks to whoever wrote this, you saved me a lot of time hunting for the same info on other sites, and a stop at creativehomeandstyle only added more useful detail without going off topic, that kind of focus is honestly hard to come across these days when most posts wander everywhere.
Came here from another site and ended up exploring much further than I planned, and a look at contemporarydesignhub only encouraged more exploration, the kind of place where one click leads to another not through manipulative design but through genuinely interesting content is rare and worth highlighting when found like this somewhere on the open internet.
Felt the writer did the homework before publishing, the references hold up, and a look at auralbrick continued that documented care, content with traceable claims rather than vague assertions is the kind I trust and the lack of bald assertion in this post is one of its quietly impressive qualities for me.
Picked this site to mention to a colleague who would benefit, and a look at intentionalstylehub added more material I will pass along, recommending sites to colleagues is a higher bar than recommending to friends because the professional context demands more careful curation and this site cleared the professional bar without me having to think.
The depth of coverage felt about right for the format, neither shallow nor overwhelming, and a look at crazechip kept that calibration going, getting the depth right for blog format is genuinely difficult because too shallow loses experts and too deep loses beginners but this site nailed it nicely which I really do appreciate.
Decided to read more before commenting and the more I read the more I wanted to say something, and a stop at ulnova pushed that impulse further, when content provokes the urge to participate rather than just consume it is doing something quite specific and worth recognising clearly when it happens during reading.
Picked up something useful for a side project, and a look at birchvista added another piece I will incorporate, content that connects to specific projects I am working on is content with practical utility and the practical utility of this site is showing up across multiple posts I have read in the last hour or so.
Halfway through reading I knew this would be one to bookmark, and a look at calmbyrd confirmed that early intuition, when bookmark intent forms before finishing a post you know the writing has cleared a quality bar that most content fails to clear and this site has cleared it on multiple visits already.
Reading this in segments because the day was busy, and the post survived the fragmented attention well, and a stop at androblink held up similarly under interrupted reading, content that can withstand modern distracted reading patterns rather than requiring a perfect block of focused time is increasingly the kind I prefer.
Honestly this kind of writing is why I still bother to read independent sites, and a look at creativehomeandstyle extended that broader reflection, the few sites that justify continued attention to non algorithmic content are sites like this one and finding them periodically is enough to keep my reading habits oriented toward independent rather than aggregated content.
A piece that handled multiple complications without becoming confused, and a look at boundcliff 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.
Felt the post had been written without looking over its shoulder, and a look at compassbraid 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.
Now planning to come back when I have the right kind of attention to read carefully, and a stop at intentionalstylehub reinforced that plan, choosing the right moment to read certain content is a quiet form of respect for the work and this site is generating those careful planning behaviours from me consistently as a reader.
Looking forward to seeing what gets published next month, and a look at cobaltcrate 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.
Will be passing this along to a few people who would benefit from the perspective shared here, and a stop at ulnova only added to what I will be sharing, this kind of generous content deserves to circulate widely rather than getting buried in some search engine algorithm tweak that pushes it down the rankings.
The examples really helped me grasp the points faster than abstract descriptions would have, and a stop at beltbrunch added a few more practical illustrations that drove the message home, the kind of writing that knows its readers learn better through concrete situations rather than vague generalities is rare and worth recognising clearly.
Reading this prompted a small note in my reference file, and a stop at intentionalglobalstore 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.
Thanks for not padding this with the usual filler intros and outros that every other blog seems to require, and a quick visit to cobaltcrate continued that lean approach across more posts, content stripped of waste is content that respects you and I will always come back to that kind of approach.
Granted I am giving this site more credit than I usually give new finds, and a look at crazecocoa 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.
Solid endorsement from me, the writing earns it, and a look at kettlemarket 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.
Even across multiple posts the writers voice has remained consistent in a way I appreciate, and a stop at beltbrunch continued that voice, sites that maintain editorial consistency across many pieces have something most sites lack and this one has clearly worked out how to keep its voice steady across what reads as a growing archive.
Good post, the kind that respects the reader by getting to the point quickly without skipping the details that matter, and a short look at compassbraid confirmed that approach is consistent across the site which is rare to find online these days, definitely a place I will return to soon.
If you scroll past this site without looking carefully you will miss something, and a stop at ardenbeach extended that mild warning, the surface of the site does not advertise its quality loudly which means careful attention is required to recognise what is being offered here which is itself a kind of editorial signal.
Beats most of the alternatives on the topic by a noticeable margin, and a look at cantclap did not change that at all, this is one of the better corners of the open internet for this kind of content and I am glad I clicked through rather than skipping past quickly like I usually do.
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.
Felt the writer respected me as a reader without making a show of doing so, and a look at intentionalglobalstore continued that quiet respect, this is the kind of small but meaningful detail that separates the sites I bookmark from the ones I close after a single skim and never return to again no matter how interesting the headline.
Well crafted post, the structure flows naturally from one point to the next without forcing transitions, and a stop at civicbrisk kept the same flow going, you can tell when a writer has thought about how their content reads rather than just what it contains and this is one of those examples.
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.
Honestly impressed by the consistency of voice across what I have read so far, and a quick visit to carefullycuratedfinds 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.
Really liked the calm tone running through the post, no shouting and no urgency forced into the writing, and a look at kettlemarket kept that quiet confidence going, the kind of voice that makes the reader feel respected rather than yelled at which is depressingly common across most modern blog content these days.
Solid little post, the kind that does not need to be flashy because the substance is doing the work, and a look at crazecocoa kept that quiet confidence going across the site, this is what writing looks like when the writer trusts the content to land on its own without theatrics or unnecessary attention seeking behaviour.
Adding this to my list of go to references for the topic, and a stop at boundcling confirmed the rest of the site deserves the same, definitely the kind of resource that earns its place rather than getting forgotten the moment the next interesting article shows up in my feed somewhere else on the web.