拖了一个月终于着手并且完成了。其实没有什么难的。但是因为我对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是傻瓜操作,没有怎么弄?这个我也弄了好半天最终解决了,马上再写一篇单独说吧
好啦好啦,到此结束,路人有问题可以在下面留言~
Thank you for keeping the writing honest and the points easy to verify against your own experience, and a stop at wickerlane reflected the same approach, no exaggeration just steady useful content that I can take with me into my own work without second guessing every sentence I happen to read here.
Speaking from the perspective of a fairly demanding reader the writing here clears the bar consistently, and a look at nervora continued clearing that bar, the calibration of demanding reader is something I apply to all sources and this site has been one of the few that handles the demanding reading well across pieces sampled.
Just wanted to say this was useful and leave a small note of thanks, and a quick visit to elveecho earned a similar nod from me, the small acknowledgements add up over time and represent the real economy of trust that good content runs on across the open and increasingly fragmented modern internet.
Honestly the simplicity is what makes this work, the topic is not buried under filler words or overly complex examples, and a quick look at elevatedhomeandstyle showed the same sensible style, I left with what I came for and no headache from over reading which is a real win these days.
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 fiberiron confirmed that approach is consistent across the site which is rare to find online these days, definitely a place I will return to soon.
Reading this on a long flight and finding it the best thing I read across hours of trying, and a stop at jewelvendor kept the streak going, when content beats long flight reading you know it has substance because flight reading is a hard test of a piece given the alternatives available everywhere.
Thanks for the readable length, I finished it without checking how much was left, and a stop at balticbull kept me reading the same way, when I stop noticing the length of a piece because the content is engaging enough to sustain attention without willpower the writer has done their job well today.
Coming to this with low expectations and being pleasantly surprised by the substance, and a stop at timbermarket continued exceeding expectations, the recalibration of expectations upward across multiple positive readings is one of the actual rewards of careful browsing and this site is providing that recalibration at a steady rate apparently.
Took a quick scan first and then went back to read properly because the post deserved it, and a stop at clamable kept me reading carefully too, the kind of writing that earns a slower second pass rather than getting skimmed and forgotten is something I value highly when I happen to find it.
Reading this triggered a small but real correction in something I had assumed, and a stop at blitzbraid 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.
Felt the post had been written without using a single buzzword, and a look at wickerlane continued that clean vocabulary, content free of jargon and trendy phrases reads better and ages better and this site has clearly committed to a vocabulary that will not feel dated in three years which is impressive editorially.
Worth pointing out that the writing reads as confident without being defensive about it, and a look at yovrisa extended that secure tone, content that does not pre emptively argue against imagined critics has a different quality from defensive writing and this site reads as written from a place of real ease.
Clean writing, easy to read, and never tries too hard to impress, that combination is harder to find than people think, and after my time on bowcask I am sure this site treats its readers well, no flashy tricks just useful content done right which is honestly all I want online.
Thank you for keeping the writing honest and the points easy to verify against your own experience, and a stop at nervora reflected the same approach, no exaggeration just steady useful content that I can take with me into my own work without second guessing every sentence I happen to read here.
Reading this prompted a small redirection in something I was working on, and a stop at refinedeverydaynecessities 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.
Honestly the simplicity is what makes this work, the topic is not buried under filler words or overly complex examples, and a quick look at elevatedhomeandstyle showed the same sensible style, I left with what I came for and no headache from over reading which is a real win these days.
Decided to write a short note to the author if there is contact info anywhere, and a stop at merniva extended that intention, the urge to thank the writer directly is a strong signal of content quality and this site has triggered that urge in me today which is a fairly rare event for my reading.
A well calibrated piece that knew its scope and stayed inside it, and a look at arialcamp maintained the same scope discipline, scope creep is one of the failure modes of long blog posts and this site has clearly invested in the editorial discipline to prevent it which shows up in tightly contained pieces.
Bookmark moved to my permanent reference folder rather than the casual maybe later folder, and a look at jewelvendor earned the same upgrade, the distinction between casual interest and lasting reference is something I track carefully and very few sites cross that threshold but this one did so without much effort apparently.
My professional context would benefit from having this kind of resource available, and a look at fiberiron extended the professional applicability, the rare site that contributes meaningfully to professional work rather than just personal interest is content with multiplied value and this one is providing that professional utility consistently across multiple pieces.
Felt the post was written for someone like me without explicitly addressing me, and a look at elveecho produced the same fit, when content lands on its target without pandering you know the writer has done careful audience thinking rather than relying on demographic targeting or interest signals to do the work of editorial decisions.
Genuinely well crafted writing, the kind that makes the topic look easier than it actually is, and a look at blitzbraid added even more depth, you can feel the experience behind every line which is something only writers who have been at this for a while can pull off with this level of grace.
Now placing this in the small category of sites whose updates I would actually want to know about, and a stop at refineddailycommerce confirmed that placement, the difference between sites I want to follow and sites I just consume from is real and this one has crossed into the active follow category from the casual consumption side.
Reading this in the time it took to drink half a cup of coffee, and a stop at crustborn 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.
Genuine pleasure to read, and that is not something I say often after a casual click through, and a quick visit to cargocomet kept the same feeling going across the rest of the site, finding writing that actually feels good to spend time with rather than just functional is increasingly rare on the open web.
прайс клининг спб
Decided not to skim despite my usual habit and was rewarded for the discipline, and a stop at refinedeverydaynecessities earned the same patient approach, training myself to recognise sites that warrant slower reading is part of being a careful online reader and this site is the kind that helps me practice that skill regularly.
Solid value for anyone willing to read carefully, and a look at arialcamp extends that value across the rest of the site, this is the kind of place that rewards return visits rather than offering everything in a single splashy post and then leaving readers nothing to come back for later which is unfortunately common.
After reading several posts back to back the consistent voice across them is impressive, and a stop at conchclove continued that voice consistency, sites that maintain a single coherent voice across many pieces by potentially many writers represent serious editorial discipline and this one has clearly developed the institutional consistency needed for that.
Quietly the post solved something I had been turning over without quite knowing how to phrase the question, and a look at merniva extended that quiet solving, content that addresses unformulated needs is content with reader insight and this site has demonstrated that insight at a high rate across the pieces I have read recently.
Now realising this site has been quietly doing good work for longer than I knew, and a look at timbermarket suggested an archive worth exploring, sites with deep archives of consistent quality represent a different kind of resource than sites with viral hits and this one looks like the durable kind based on what I see.
Now placing this in the small category of sites whose updates I would actually want to know about, and a stop at refineddailycommerce confirmed that placement, the difference between sites I want to follow and sites I just consume from is real and this one has crossed into the active follow category from the casual consumption side.
Better signal to noise ratio than most places I check on this kind of topic, and a look at crustborn kept that going, every paragraph here carries something worth reading rather than padding out the page to hit some arbitrary length target that search engines reward but readers ignore as soon as they notice it.
Appreciate the thoughtful approach, the writer clearly took time to make this readable for someone who is not already an expert, and a look at balticcape kept that going nicely, easy on the eyes and easy on the brain which is always a winning combination when reading on a busy day.
Sets a higher bar than most of what shows up in search results for this topic, and a look at cargocomet did not lower that bar at all, in fact it confirmed the impression, this is the kind of consistency that earns a place in regular rotation for serious readers instead of casual scrollers passing through.
Worth saying this site reads better than most paid newsletters I have tried, and a stop at iciclecrate confirmed that comparison, the bar for free content is often lower than for paid but this site clears the paid bar consistently and that says something about the editorial approach behind the work being published here regularly.
Now feeling the quiet pleasure of finding writing that takes itself seriously without being self serious, and a stop at harbormint extended that subtle pleasure, the gap between earnest and pretentious is fine and this site has clearly chosen to land on the earnest side without slipping over into pretentious which is impressive.
Looking for similar voices elsewhere has come up empty in my recent searches, and a stop at globalmodernessentials 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.
A piece that handled a controversial angle without becoming heated, and a look at orderquill continued that calm engagement, content that can address contested topics without inflaming them is doing rare diplomatic work and this site has clearly developed the editorial maturity to handle sensitive material with the appropriate temperature of writing throughout.
Felt this in a way I cannot quite explain, the topic just hit different here, and a stop at boneblot continued in that vein, sometimes you find a site whose perspective lines up with how you have been thinking and reading their work feels like a small relief which I appreciated more than I expected.
Came in confused about the topic and left with a much firmer grasp on it, and after amberdock I felt I could explain this to someone else without hesitation, that is the gold standard for any educational content and most sites simply fail to reach it ever which is unfortunate but true.
However casually I came to this site I have ended up reading carefully, and a look at conchclove continued earning that careful reading, the conversion from casual visitor to careful reader is something content earns rather than demands and this site has accomplished that conversion for me over the course of just a few pieces.
Bookmarking this for later, the kind of resource I want to keep nearby, and a quick look at bowclub confirmed the rest of the site is worth the same treatment, definitely going into my reference folder for the next time the topic comes up at work or in conversation with someone who asks.
Worth recognising that the post handled a familiar topic without reaching for any of the obvious hot takes, and a stop at elveglide continued that fresh treatment, sites that find new angles on subjects others have exhausted are sites worth following carefully and this one has clearly developed that exploratory instinct through patient practice.
Just want to flag that this was useful and not bury the appreciation in caveats, and a look at harbormint earned the same direct praise, recognising good work without hedging it with criticism is something I try to practice because over qualified compliments tend to read as backhanded and miss the point sometimes.
Bookmark moved to my permanent reference folder rather than the casual maybe later folder, and a look at iciclecrate earned the same upgrade, the distinction between casual interest and lasting reference is something I track carefully and very few sites cross that threshold but this one did so without much effort apparently.
Liked how the writer used real examples instead of theoretical ones to make the points stick, and a stop at ethicalhomeandlifestyle added even more concrete examples, this is the kind of practical approach that respects readers who actually want to apply what they learn rather than just nodding along passively without doing anything useful.
Picked up on several small touches that suggest a careful editor, and a look at globalmodernessentials suggested the same hand at work across the broader site, editorial consistency at a granular level is one of the strongest signs that an operation is serious rather than just hobbyist and this site reads as serious throughout.
Glad to have another reliable bookmark for this topic, and a look at balticcape suggested several more pages I will be marking too, building a personal library of trustworthy resources is one of the actual rewards of careful browsing and this site is earning a place on my permanent shortlist for the topic.
Really thankful for posts that respect a reader’s time, this one does, and a quick look at claycargo 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.