首先在阿里云购买一台centOS7.2的机器
然后使用ssh的命令去连接着台机器:例如
ssh 114.215.138.99 -l root
然后会有一个选择是否允许,输入yes
The authenticity of host '114.215.138.99 (114.215.138.99)' can't be established.
ECDSA key fingerprint is SHA256:yIaA8igcJaL4ALkMUBddoUj+Wq2PDqc6nOpgT4dTml0.
Are you sure you want to continue connecting (yes/no)? yes
然后是安装必须的软件
yum install nginx mariadb php php-fpm php-mysql
注意这里的php 和php-mysql 都是小写的,看下面的图片,不知道csdn怎么搞的,都变成了大些了。
下载并且更新repo,为了能够安装mysql-server
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server
然后是下载wordpress
[root@iZm5ee1przeygbj5v6l7jwZ ~]# wget https://cn.wordpress.org/wordpress-4.0-zh_CN.tar.gz
解压:
[root@iZm5ee1przeygbj5v6l7jwZ ~]# tar -xvf wordpress-4.0-zh_CN.tar.gz -C /var/www/html/
然后跳转到如下目录,
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# cd /var/www/html/wordpress/
启动服务nginx,然后可以通过ps的命令查看是否启动过了,启动过了会有
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# nginx
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# ps -e | grep nginx
1183 ? 00:00:00 nginx
1184 ? 00:00:00 nginx
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]#
连接mysql
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# systemctl start mysqld
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# mysql
mysql> create database wordpress;
mysql> grant all on wordpress.* to sqladmin@localhost identified by "1234";
mysql>
然后修改配置文件, 修改root 那一行,千万别忘了html后面的逗号,root /var/www/html;
root@iZm5ee1przeygbj5v6l7jwZ nginx]# vi /etc/nginx/nginx.conf
并且在location 里面添加内容如下:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
# root /usr/share/nginx/html;
root /var/www/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
root /var/www/html;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
# root /usr/share/nginx/html;
root /var/www/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
root /var/www/html;
index index.html index.htm index.php;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
location ~ \.php$ {
root /var/www/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
}
}
# Settings for a TLS enabled server.
#
# server {
# listen 443 ssl http2 default_server;
# listen [::]:443 ssl http2 default_server;
# server_name _;
# root /usr/share/nginx/html;
#
# ssl_certificate "/etc/pki/nginx/server.crt";
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
#
# # Load configuration files for the default server block.
# include /etc/nginx/default.d/*.conf;
#
# location / {
# }
#
# error_page 404 /404.html;
# location = /40x.html {
# }
#
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
# }
}
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]#
nginx -s reload
然后就可以直接访问了:例如:http://114.215.138.99/wordpress/
点击现在就开始:这里的用户名和密码就是
上面的密码就是之前步骤里面设置的:
创建数据库,初始化,将数据库授权给sqladmin,密码是1234.
mysql> create database wordpress;
mysql> grant all on wordpress.* to sqladmin@localhost identified by "1234";
mysql>
如果显示没有权限:
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# cd /var/www/html/wordpress
[root@iZm5ee1przeygbj5v6l7jwZ wordpress]# vi wp-config.php
然后将下面的内容拷贝进去
<?php
/**
* WordPress基础配置文件。
*
* 本文件包含以下配置选项:MySQL设置、数据库表名前缀、密钥、
* WordPress语言设定以及ABSPATH。如需更多信息,请访问
* {@link http://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
* 编辑wp-config.php}Codex页面。MySQL设置具体信息请咨询您的空间提供商。
*
* 这个文件被安装程序用于自动生成wp-config.php配置文件,
* 您可以手动复制这个文件,并重命名为“wp-config.php”,然后填入相关信息。
*
* @package WordPress
*/
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'wordpress');
/** MySQL数据库用户名 */
define('DB_USER', 'sqladmin');
/** MySQL数据库密码 */
define('DB_PASSWORD', '1234');
/** MySQL主机 */
define('DB_HOST', 'localhost');
/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');
/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');
/**#@+
* 身份认证密钥与盐。
*
* 修改为任意独一无二的字串!
* 或者直接访问{@link https://api.wordpress.org/secret-key/1.1/salt/
* WordPress.org密钥生成服务}
* 任何修改都会导致所有cookies失效,所有用户将必须重新登录。
*
* @since 2.6.0
*/
define('AUTH_KEY', 'MsfI*)E^*goK#ziT|G~durg;`$s2usGLsYD];jQ#eP-L-:nDn)qy_Wtsi<(h]Hc^');
define('SECURE_AUTH_KEY', '3S;#|S$%F!/7RsGLo,%LerX{iqWH;&w1I/]M.[OfI4Dl|V7V$qsv; M|g@FJg5;%');
define('LOGGED_IN_KEY', 'Wa;bh!6j7(lPV@a]+b}q.{c1$?^=@PMC7mMSh4uoq?tjjIBKnQp2l(TP-G<gER`V');
define('NONCE_KEY', 'Y-=Z^/P;(l7}L@-T+oh1COQ4,u%/3lA6C!NfD?}{!e.3S52U}Y6ClKesq[:YF-s-');
define('AUTH_SALT', '4/PuJ,[eIZWT-89q%H5^msv<,E;3{?}-:jK-h^n(hS8{3[[(+D*F`s^+Iba$Kich');
define('SECURE_AUTH_SALT', '{+#98o/#+z#vqu5dfWj(*h>43*oN}aSXpvn.^4aSBjX+y0kB^Kvq8-+cd;4g:x<e');
define('LOGGED_IN_SALT', 'E<YslZ-xak>ZKp6*Z |Pc!JqQ~c-1IZX**zo6PVSM};+%`V*?PI$gif@w;HGaDcw');
define('NONCE_SALT', '^wAz*Emtf|A2cV=aJz1Gs1C4lWP{R<j+Qr0w9ZwA-2)QZ^aq99Ooc`GcE,X`-h[C');
/**#@-*/
/**
* WordPress数据表前缀。
*
* 如果您有在同一数据库内安装多个WordPress的需求,请为每个WordPress设置
* 不同的数据表前缀。前缀名只能为数字、字母加下划线。
*/
$table_prefix = 'wp_';
/**
* 开发者专用:WordPress调试模式。
*
* 将这个值改为true,WordPress将显示所有用于开发的提示。
* 强烈建议插件开发者在开发环境中启用WP_DEBUG。
*/
define('WP_DEBUG', false);
/**
* zh_CN本地化设置:启用ICP备案号显示
*
* 可在设置→常规中修改。
* 如需禁用,请移除或注释掉本行。
*/
define('WP_ZH_CN_ICP_NUM', true);
/* 好了!请不要再继续编辑。请保存本文件。使用愉快! */
/** WordPress目录的绝对路径。 */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** 设置WordPress变量和包含文件。 */
require_once(ABSPATH . 'wp-settings.php');
点击进行安装:
然后就是设置密码了,这里就不显示了
大功告成
每一次重启执行下面的:
nginx
systemctl start php-fpm
问题汇总:
阿里云 使用镜像mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 使用镜
http://blog.csdn.net/rodulf/article/details/70213412ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' ( http://blog.csdn.net/rodulf/article/details/70215313
解决安装WordPress主题及插件需要输入FTP问题 http://blog.csdn.net/rodulf/article/details/70217418CentOS7使用firewalld打开关闭防火墙与端口 http://blog.csdn.net/rodulf/article/details/70226309
wordpress 插件 easy video player https://wordpress.org/plugins/easy-video-player/ http://blog.csdn.net/rodulf/article/details/70229810
WordPress提示“在裁剪您的图像时发生了错误”的解决方法 http://blog.csdn.net/rodulf/article/details/70229907
如果需要设置ftp:请参考:http://blog.csdn.net/rodulf/article/details/70217025
如果需要将文章转到微信:http://blog.csdn.net/rodulf/article/details/70230091
参考:http://jingyan.baidu.com/article/ca41422fd9593c1eae99edac.html