在Apache2部署WordPress程序, 环境:Ubuntu 14.04 LTS x64 MySQL 5.5 Apache 2.4.7 WordPress 4.5.2-zh_CN 安装MySQLsudo apt-get install mysql-server 安装过程中会有几个设置选项:
测试MySQL安装成功: mysql -u root -p Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 42 Server version: 5.5.49-0ubuntu0.14.04.1 (Ubuntu) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> 安装Apache2sudo apt-get install apache2 浏览器地址中输入: http://localhost/ 或者 http://127.0.0.1 看到Apache2主页
Apache2重启时遇到 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message 解决: sudo vim /etc/apache2/apache2.conf # 输入一下内容 ServerName 127.0.0.1 # 重启Apache2 sudo service apache2 restart 安装php5sudo apt-get install php5 安装PHP其他模块 # MySQL连接 sudo apt-get install php5-mysql # 安装phpMyAdmin sudo apt-get install phpMyAdmin # Web server to reconfigure automatically # 选择Apache2 # Configure database for phpmyadmin with dbconfig-common? # Yes # Password of the database's administrative user: # MySQL application password for phpmyadmin: # Password confirmation: # 创建连接 sudo ln -s /usr/share/phpmyadmin /var/www/html 测试PHP和phpMyAdmin安装成功
cd /var/www/html sudo vim test.php # 加入Hello PHP! 保存退出 浏览器输入: http://localhost/test.php
浏览器输入: http://localhost/phpmyadmin # 进入登录页面 安装WordPress官网下载WordPress
sudo tar -zxvf wordpress-4.5.2-zh_CN.tar.gz -C /var/www/html/
# 登录MySQL mysql -u root -p # 创建数据库 create database db_wp; # 查看数据库 show databases;
浏览器输入: http://localhost/wordpress
数据库名 数据库用户名 数据库密码 数据库主机 数据库表前缀
sudo vim /var/www/html/wordpress/wp-config.php # 将浏览器上的内容复制进去 # 将编码格式改成utf8 /** 创建数据表时默认的文字编码 */ define('DB_CHARSET', 'utf8'); # 保存退出,浏览器进行安装
站点标题 用户名 密码 电子邮箱
|