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

  1. melbet_apSi

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

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

    Reply
  2. Barneyfer

    Well crafted post, the structure flows naturally from one point to the next without forcing transitions, and a stop at elitedawn 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.

    Reply
  3. Walterzooge

    Worth saying that the prose reads naturally without straining for style, and a stop at cadetgrails maintained the same unforced quality, writing that achieves elegance without effort is the highest tier and this site has clearly worked out how to land that effortless quality consistently rather than only on the writers best days.

    Reply
  4. Kileder

    Liked that there was nothing performative about the writing, and a stop at neatdawn continued that genuine quality, performative writing tries to be witnessed rather than read and the difference between performance and substance is huge for the careful reader and this site has clearly chosen substance every time clearly.

    Reply
  5. Piercefet

    Recommended without hesitation if you care about careful coverage of this topic, and a stop at coralbrooktradingfoundry reinforced the recommendation, the bar I set for unhesitating recommendations is fairly high and this site has cleared it through the cumulative weight of multiple consistently good pieces rather than through any single standout post which is meaningful.

    Reply
  6. Jermaineclicy

    Recommended without hesitation if you care about careful coverage of this topic, and a stop at fiberiron reinforced the recommendation, the bar I set for unhesitating recommendations is fairly high and this site has cleared it through the cumulative weight of multiple consistently good pieces rather than through any single standout post which is meaningful.

    Reply
  7. QuinnMeamp

    Really grateful for content like this, it does not waste my time and it does not insult my intelligence either, and a quick look at lakelake was the same, balanced respectful writing that makes a person feel welcome rather than rushed through pages of forced engagement just to keep clicking around.

    Reply
  8. 1xbet giris_asOa

    Daha önce hiç böyle bir site görmemiştim. Açıkçası önyargılıydım biraz. Sonra şansımı denemek istedim.

    Bahis dünyasına ilgi duyanlar bilir. Detaylı incelemeleri tamamlayıp adımları takip ettikten sonra her şey netleşti. Giriş adresi işte karşınızda: 1xbet güncel adres 1xbet güncel adres. Kısacası durum ortada — 1xbet spor bahislerinin adresi burada.

    Hem hızlı hem güvenilir. Kendi adıma konuşuyorum — deneyen herkes memnun kaldı. Şimdiden iyi eğlenceler…

    Reply
  9. MatthewreofE

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

    Reply
  10. luxury car rental miami_wyMr

    Look, I’ve been around the block with these Miami car rentals. Or worse — they freeze your credit card for an extra two grand and smile like it’s totally normal. No thanks, I am completely done with that circus. When you are trying to find a reliable premium fleet down here, make sure to check the actual fleet reviews before signing anything. Everyone who lives here knows that having a solid car is essential, especially if you want ice-cold AC and no ridiculous daily mileage caps.

    I’ve literally compared maybe 15 different local providers last month alone, until I finally stumbled across one that actually delivers what it promises. If you are looking for an honest source for premium rentals across Florida, check the details here: luxury car hire near me https://luxury-car-rental-miami-2.com. Yeah, finding parking in downtown is still its own separate nightmare, but that’s on you. Anyway, at least there’s one trustworthy service left in this town, let me know if you guys know any other clean spots.

    Reply
  11. 1xbet giris_xwOa

    Sürekli karşıma çıkıyordu ama denememiştim. Denemekle denememek arasında gidip geldim. Sonra şansımı denemek istedim.

    Spor bahislerinde iddialı olanlar buraya. Detaylı incelemeleri tamamlayıp adımları takip ettikten sonra her şey netleşti. Giriş adresi işte karşınızda: 1xbet yeni giriş 1xbet yeni giriş. Yani anlayacağınız — 1xbet güncel adres arayanlara duyurulur.

    Hem hızlı hem güvenilir. Kimseye zararı dokunmaz — başka bir yere ihtiyacınız kalmaz. Gözünüz arkada kalmasın…

    Reply
  12. MarshallDET

    Now planning to recommend this site in a context where my recommendations are taken seriously, and a stop at elaniris confirmed I should make that recommendation soon, the small but real act of recommending content into spaces where my taste matters is something I take seriously and this site is worth the recommendation.

    Reply
  13. Gilbertfar

    Reading this brought back the satisfaction I used to get from blogs ten years ago, and a stop at draftglades kept that nostalgic quality alive, sites that capture what was good about an earlier era of internet writing are increasingly precious and this one is doing that without feeling like a deliberate throwback at all.

    Reply
  14. ArthurJar

    Quietly enthusiastic about this site after the past few hours of reading, and a stop at tealharborcommercegallery extended that enthusiasm, the calibration of enthusiasm to evidence is something I try to maintain and this site has earned a calibrated quiet enthusiasm rather than the loud excitement that usually fades within a day or two of finding something.

    Reply
  15. magazin premialnih tovarov_ayen

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

    Reply
  16. Petegat

    A small thank you note from me to the team behind this work, the post earned it, and a stop at irisarbor suggested more thanks would be in order over time, recognising the people who do good writing online is something I try to remember to do because the alternative is silence and silence rewards mediocrity unfortunately.

    Reply
  17. Alvinshouh

    Over the course of reading several posts here a pattern of quality has emerged, and a stop at gladeridgeartisanexchange confirmed the pattern, the difference between sites that hit quality occasionally and sites that hit it consistently is huge and this site has clearly demonstrated the consistent kind through what I have read this morning.

    Reply
  18. BrettNuard

    Reading this in three sittings because the day was fragmented, and the piece survived the fragmentation, and a stop at pacecabin held up under similar reading conditions, content engineered for continuous attention is fragile in modern conditions and this site reads as durable across the realistic ways people consume content today.

    Reply
  19. 1xbet giris_wtpi

    Denemek isteyen herkese aynı şeyi söylüyorum. İnanın herkes farklı bir adres veriyor kafayı yedim. Güncel detayları inceleyip sistemi test ettim ve sorunsuz çalıştı. En doğru adrese ulaştığımı düşünüyorum ve size de buradan bahsetmek istiyorum: 1xbet güncel adres 1xbet güncel adres. Şöyle düşünün yani — casino sevenler için ideal bir ortam var gerçekten.

    bonus kampanyaları bile beklentimin üzerindeydi. Kendi tecrübelerimi aktarıyorum size — kesinlikle pişman olmazsınız deneyin derim. Umarım siz de memnun kalırsınız…

    Reply
  20. luxury car rental miami_vkkn

    Let me save you some headache I learned the hard way. Half these local companies promise a custom Porsche and hand you a basic sedan with fake leather. You book a premium ride online, arrive all excited, then boom — hidden service fees everywhere. Fool me thrice, shame on both of us I guess, lesson learned. 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, 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: porsche rental near me https://luxury-car-rental-miami-3.com. Also, definitely bring sunglasses unless you enjoy driving completely blind in that sun. Just drive safe out there and maybe skip the extra windshield protection thing. hope this helps some of you save a few bucks.

    Reply
  21. Isaiahapeft

    Quietly impressive in a way that does not announce itself, and a stop at buildsteadyprogress 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
  22. melbet_tpSi

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

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

    Reply
  23. ThomasSoill

    Все о дизайне https://bconline.com.ua интерьера в одном месте. Современные стили, идеи для ремонта, подбор мебели, освещения и отделочных материалов. Практические советы помогут создать уютное и функциональное пространство.

    Reply
  24. Robinjoist

    Дизайн и интерьер https://ukk.kiev.ua идеи для оформления квартир, домов и коммерческих помещений. Современные тенденции, советы дизайнеров, готовые решения и вдохновляющие проекты для создания стильного и комфортного пространства.

    Reply
  25. Tomasamism

    Ремонт и строительство https://oo.zt.ua без лишних сложностей. Подробные руководства, рекомендации специалистов, обзоры материалов и полезные идеи для создания надежного, красивого и функционального жилья.

    Reply
  26. DavidNeath

    Информационный ресурс https://it-cifra.com.ua о строительстве и ремонте с акцентом на реальные решения, проверенные технологии и практический опыт. Узнавайте, как строить надежно, ремонтировать качественно и экономить бюджет.

    Reply
  27. Walterzooge

    Bookmark added in three places to make sure I do not lose the link, and a look at cadetgrails got the same redundant treatment, sites I am afraid to lose are the rare keepers and this is clearly one of them based on what I have read so far across this and a couple of related posts.

    Reply
  28. melbet_xwen

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

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

    Reply
  29. Narkolog na dom_lsPl

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

    Reply
  30. Piercefet

    Honestly this was a good read, no jargon and no padding, and a short look at coralbrooktradingfoundry kept that same feel going which I really appreciated, the writer clearly knows the topic well enough to explain it without hiding behind big words or filler that often gets used to seem clever.

    Reply
  31. Narkologicheskii stacionar_daSl

    Знаете, поиск действительно проверенного медицинского центра — это всегда целая проблема и головная боль. Нередко в жизни бывает так, когда кому-то из членов семьи внезапно потребовалась экстренная и профессиональная поддержка. И тут сразу возникает главный вопрос: куда именно везти человека?

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

    Все важные детали и лицензии центра находятся только тут: лечение алкоголизма в стационаре спб narkologicheskij-staczionar-sankt-peterburg-12.ru. Честно говоря, после изучения всех условий, насколько там много подводных камней, на которые стоит обращать внимание, и главное — там работают доктора, которые реально спасают людей. Для Санкт-Петербурга это точно один из самых лучших вариантов, так что рекомендую сохранить себе в закладки на всякий случай.

    Reply
  32. QuinnMeamp

    Worth pointing out that the writing reads as confident without being defensive about it, and a look at lakelake 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.

    Reply
  33. Jermaineclicy

    Started thinking about my own writing differently after reading, and a look at fiberiron continued that reflective effect, content that influences how I work rather than just informing what I know is content with the highest kind of impact and this site has triggered some of that reflective influence today on me.

    Reply
  34. luxury car rental miami_caMr

    Let’s be real, finding a decent rental company down here is a nightmare. Or worse — they freeze your credit card for an extra two grand and smile like it’s totally normal. Fool me once, shame on you, right. If you actually need a proper vehicle to cruise around the city, seriously, do your homework first and don’t just trust social media ads. Everyone who lives here knows that having a solid car is essential, especially if you want ice-cold AC and no ridiculous daily mileage caps.

    I’ve literally compared maybe 15 different local providers last month alone, until I finally stumbled across one that actually delivers what it promises. If you are looking for an honest source for premium rentals across Florida, check the details here: mercedes car rent https://luxury-car-rental-miami-2.com. Oh, and definitely bring polarized sunglasses, because that Florida sun is absolutely no joke. Anyway, at least there’s one trustworthy service left in this town, hope this helps someone save a few bucks.

    Reply
  35. Gilbertfar

    Now thinking about whether the writer might publish a longer form work I would buy, and a look at draftglades suggested the same depth would translate, content that makes me want to pay for related work in other formats is content that has earned commercial trust as well as attention trust and this site has both clearly.

    Reply

Leave a Reply

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