WordPress从Apache迁移到Nginx过程
来源:互联网 发布:聊天使用什么网络库 编辑:程序博客网 时间:2024/04/29 18:17
WordPress从Apache迁移到Nginx过程
代码迁移
- 使用git上传然后clone,方便以后的管理还有迁移
- 直接打包,然后在另外的一台机子上wget下来
使用打包的方式
打包
tar -zcvf wordpress.tar.gz --exclude=wordpress/.git cqc
把打包好的文件放在服务器能不访问的文件夹里面,在另外的一台机子的终端
wget http://xxx.xxx.xxx.xxx/wordpress.tar.gz
解压
tar zxvf wordpress.tar.gz
数据库迁移
把数据库导出来,导入到另外的机器上就行
数据库用二者的phpmyadmin导出和上传即可。我导出 .sql 文件,大小为9M,而phpMyAdmin的上传限制大小是2M,怎么办?其实我们可以压缩 .sql 文件为 zip格式,压缩之后就有了1.4M了,分分钟完成上传。要知道 phpMyAdmin 可是支持 .sql.zip 文件的。
配置vhosts
apache 在wordpress上在使用了伪静态,所有在nginx上也要使用伪静态
ubuntu 在 /etc/nginx 目录下可以新建一个 vhosts文件夹。在这里我们要解析 wordpress 目录,那么我就新建一个 wordpress.conf 文件。
现在例如我要把 blog.cuiqingcai.com 解析到 wordpress 文件夹,配置如下
server { listen 80; server_name cuiqingcai.com blog.cuiqingcai.com; index index.html index.htm index.php; root /var/www/cqc; location / { if (!-e $request_filename) { rewrite ^([_0-9a-zA-Z-]+)?(/wp-.*) $2 last; rewrite ^([_0-9a-zA-Z-]+)?(/.*\.php)$ $2 last; rewrite ^ /index.php last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; # # With php5-fpm: # fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/cqc$fastcgi_script_name; include fastcgi_params; }}
之后在 /etc/nginx/nginx.conf 中的 http{} 中添加一行
include /etc/nginx/vhosts/cqc.conf;
我配置二级项目的时候使用如下配置
vi /etc/nginx/conf.d/default.conf
server { listen 80; server_name www.biyongyao.com; charset utf-8; access_log /var/log/nginx/access.log main; #root /usr/share/nginx/html/wordpress; root /home/biyongyao/www/wordpress; index index.php index.html index.htm; location / { try_files $uri $uri/ =404; if (!-e $request_filename) { rewrite ^([_0-9a-zA-Z-]+)?(/wp-.*) $2 last; rewrite ^([_0-9a-zA-Z-]+)?(/.*\.php)$ $2 last; rewrite ^ /index.php last; } } location /ed2k/ { if (!-e $request_filename){ rewrite ^/ed2k/(.*)$ /ed2k/index.php?s=/$1 last; } } location /MobileShop/ { if (!-e $request_filename){ rewrite ^/MobileShop/(.*)$ /MobileShop/index.php?s=/$1 last; } } error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }}
原文地址:http://biyongyao.com/archives/225
阅读全文
0 0
- WordPress从Apache迁移到Nginx过程
- zendframework 从apache下迁移到nginx下
- 迁移Wordpress网站到PostgreSQL/Nginx
- 将WordPress博客从Apache移植到Nginx后的若干问题总结
- https配置从tomcat迁移到Nginx
- wamp 从安装到wordpress的发布、迁移
- 在windows环境下从wordpress迁移到jekyll
- 博客从wordpress迁移到Github.io、GitCafe
- 【wordpress】如何把wordpress从本地服务器迁移到网站主机上
- 从MR到Hive – 一次迁移的过程
- 从Cocos2d-x2迁移到Cocos2d-x3的过程分享
- 从 MapReduce 到 Hive —— 一次迁移过程小记
- 如何把wordpress从本地服务器迁移到网站主机上
- WebSphere 迁移: 将 Web 应用程序从 Apache Tomcat 迁移到 WebSphere Application Server Community Edition
- wordpress博客服务器迁移过程总结
- wordpress博客服务器迁移过程中总结
- ranxk.com优化之--从apache换到nginx
- 从apache负载均衡到nginx负载均衡
- web log日志
- 3.1.4在notify方法执行完之后不立即释放锁
- Classes as objects(元类)
- Dungeon Master
- oracle 数据库恢复时两个重要的参数
- WordPress从Apache迁移到Nginx过程
- 数据库和MySQL相关面试题目
- 使用Servlet上传多张图片——Dao层(BaseDao.java)
- POJ 2151 Check the difficulty of problems 概率DP入门
- 使用Servlet上传多张图片——Dao层(ProductInfoDao.java)
- domain,DNS,冗余,DNS劫持的大致原理
- VMware通过vmdk文件创建虚拟机
- 2-1 Point类的定义
- Spring Boot 中集成 Spring Security