部署wordpress

1.  准备工作

    1.  数据库

        create database wordpress;  创建数据库

        grant all on wordpress.* to wordpress@'localhost' identified by '123456';

        flush privileges;

        select user,host from mysql.user;

        show grants for wordpress@'localhost';

    2.  nginx和php配置  

[root@rsync-server website]# cat wordpress.conf 
server {
        listen 80;
        server_name blog.cmr.com.cn;
        access_log logs/blog.log main;
        location / {
           root html/wordpress;
           index index.php index.html index.htm;
           }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ .*\.(php|php5)?$ {
           root html/wordpress;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           include fastcgi.conf;
        }
}

    3.  获取wordpress代码

        cd /home/tools/

        wget https://wordpress.org/latest.tar.gz

        tar -zxvf  latest.tar.gz

        mv wordpress/* /application/nginx/html/wordpress

        chown -R nginxuser.nginxuser wordpress

2.  通过客户端浏览器进行安装wordpress。

    傻瓜式的,添加数据库账户和密码,一步一步完成即可。

3.  实现wordpress博客程序URL静态化

4.  修改一下nginx的配置文件

[root@rsync-server website]# cat wordpress.conf 
server {
        listen 80;
        server_name blog.cmr.com.cn;
        access_log logs/blog.log main;
        root html/wordpress;
        index index.php index.html index.htm;
        location / {
          if (-f $request_filename/index.html) {
             rewrite (.*) $1/index.html break;
          }
          if (-f $request_filename/index.php) {
             rewrite (.*) $1/index.php;
          } 
          if (!-f $request_filename) {
             rewrite (.*) /index.php;
          } 
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        location ~ .*\.(php|php5)?$ {
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           include fastcgi.conf;
        }
}
posted @ 2018-06-27 00:02  奋斗史  阅读(1037)  评论(0)    收藏  举报