本地环境下 WordPress 环境搭建与安装

本地环境:Ubuntu 14.04

使用软件:

安装步骤:

  • 安装 LNMP 环境;

    wget -qO ee rt.cx/ee && sudo bash ee
    sudo ee stack install --adminer

    安装LNMP和数据库管理工具 Adminer。

  • 安装 PHP + MySQL 站点;

    sudo ee site create wp.exa --mysql

    新建一个域名为 wp.exa 的 PHP + MySQL 站点。

  • 修改本地hosts;

    sudo vim /etc/hosts ' 添加一行"127.0.0.1 wp.exa"
    sudo /etc/init.d/networking restart

    修改本机上 hosts 保证能访问到 wp.exa,再重启动网络连接使 wp.exa 生效。

  • 安装 WordPress;

    浏览器打开 https://api.wordpress.org/secret-key/1.1/salt/

    记录下salt信息。

    sudo ee site info wp.exa

    记录下 wp.exa 的 DB_NAME、DB_USER 和 DB_PASS。

    sudo ee site cd wp.exa
    sudo git clone https://git.oschina.net/diancloud/WordPress_diancloud.git htdocs
    sudo chown -R www-data:www-data htdocs

    在 wp.exa 的 htdocs 目录中安装 WordPress 4.1.1 中文优化版,并配置好安装目录的用户。(下次试一试:git clone 不用 sudo,后面不用 sudo chown)

    cd htdocs
    sudo vim wp-config.php

    文件中的 htdocs 目录下的wp-config.php 文件中的 DB_NAME、DB_USER、DB_PASSWORD、table_prefix 和 salt信息。在文件中大致如下的代码,其中***代表不同计算机产生不同的信息。

    define('DB_NAME', 'wp_exa');
    define('DB_USER', 'wp_exa');
    define('DB_PASSWORD', '***');
    $table_prefix = 'wp_exa_';

    define('AUTH_KEY', '');
    define('SECURE_AUTH_KEY', '
    ');
    define('LOGGED_IN_KEY', '');
    define('NONCE_KEY', '
    ');
    define('AUTH_SALT', '');
    define('SECURE_AUTH_SALT', '
    ');
    define('LOGGED_IN_SALT', '');
    define('NONCE_SALT', '
    ');

    打开浏览器 http://wp.exa,按照提示完成WordPress安装。

  • 收尾工作。

    exit

    退出 wp.exa 站点的目录。

小结

安装后的WordPress打开速度很多,也看到在线主题的缩略图。

posted @ 2015-04-16 13:24  信义  阅读(331)  评论(0)    收藏  举报