Wordpress安装部署

Wordpress 安装部署php

1      前言html

WordPress是一个注重美学、易用性和网络标准的我的信息发布平台。WordPress虽为免费的开源软件,但其价值没法用金钱来衡量。mysql

 

WordPress的图形设计在性能上易于操做、易于浏览;在外观上优雅大方、风格清新、色彩诱人。linux

 

使用WordPress能够搭建功能强大的网络信息发布平台,但更多的是应用于个性化的博客。针对博客的应用,WordPress能让您省却对后台技术的担忧,集中精力作好网站的内容。nginx

 

如下是wordpress安装部署方法。web

nginx(yum) + php(编译) + mysql(二进制)sql

2      安装部署api

2.1  安装配置nginxbash

2.1.1      安装nginx网络

yum install nginx

2.1.2      nginx配置

vi /etc/nginx/con.f/域名.conf

server {
    listen       80;
    server_name  域名;
    root   /usr/share/nginx/html/blog;
 
    #charset koi8-r;
    access_log  /var/log/nginx/域名.access.log  main;
    error_log   /var/log/nginx/域名.error.log;
 
    location / {
        root   /usr/share/nginx/html/blog;
        index  index.html index.htm index.php;
        try_files $uri $uri/ /index.php?$args;
    }
 
    #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/blog;
    }
 
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}
 
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           /usr/share/nginx/html/blog;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
 
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

 

2.1.3      下载wordpress

下载网址https://cn.wordpress.org/

 

2.1.4      解压wordpress

tar zxvf wordpress-4.7.2-zh_CN.tar.gz

mv wordpress /usr/share/nginx/html/blog/

2.2  安装配置mysql

2.2.1      下载mysql

下载网址https://www.mysql.com/

2.2.2      安装mysql(二进制)

添加用户

#useradd mysql

vi /etc/passwd

将/bin/bash改为/sbin/nologin

 

解压包

#tar zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar

#mv mysql-5.7.17-linux-glibc2.5-x86_64 /usr/local/mysql

#chown mysql. -R /usr/local/mysql/

 

配置文件

vi /etc/my.cnf

 

[client]
port = 3306
socket = /usr/local/mysql/tmp/mysql.sock
 
[mysqld]
server_id=10
port = 3306
user = mysql
socket = /usr/local/mysql /tmp/mysql.sock
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
pid-file = /usr/local/mysql/data/mysql.pid
max_connections = 1000
max_connect_errors = 1000
table_open_cache = 1024
max_allowed_packet = 128M
open_files_limit = 65535
#####====================================[innodb]==============================
innodb_buffer_pool_size = 1024M
innodb_file_per_table = 1
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_purge_threads = 2
innodb_flush_log_at_trx_commit = 1
innodb_log_file_size = 512M
innodb_log_files_in_group = 2
innodb_log_buffer_size = 16M
innodb_max_dirty_pages_pct = 80
innodb_lock_wait_timeout = 30
innodb_data_file_path=ibdata1:1024M:autoextend
 
#####====================================[log]==============================
log_error = /usr/local/mysql/log/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /usr/local/mysql/log/mysql-slow.log
 
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

 

初始化mysql

cd /usr/local/mysql

mkdir data

mkdir tmp

mkdir log

chown mysql. –R /usr/local/mysql

./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

若是配置了my.cnf的log_error,那么初始密码在log_error文件中,不然会打印出来。

cp support-files/mysql.server /etc/init.d/mysql

chmod +x /etc/init.d/mysql

 

启动mysql

/etc/init.d/mysql start

 

修改密码

mysql –uroot –p   登陆mysql

SET PASSWORD=PASSWORD('newpassword');

 

2.3  安装配置PHP

2.3.1      下载PHP

下载网址http://www.php.net/

 

2.3.2      安装PHP

解压php

tar zxvf php-5.6.30.tar.gz

编译php

cd php-5.6.30

./configure --prefix=/data/php5 --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip

make & make install

 

cp php.ini-production /data/php5/lib/php.ini

cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

cd /data/php5/etc

cp php-fpm.conf.default php-fpm.conf

 

安装mysql扩展

cd php-5.6.30

cd ext/mysql

/data/php5/bin/phpize

./configure --with-php-config=/data/php5/bin/php-config

make & make install

 

修改配置文件

vi /data/php5/lib/php.ihi

修改以下配置:

default_charset = "UTF-8"

error_log = /opt/php5/var/log/php_errors.log

upload_max_filesize = 32M

upload_tmp_dir = /opt/php5/var/tmp

date.timezone="Asia/Shanghai"

extension=mysql.so

 

vi /data/php5/etc/php-fpm.conf

修改以下配置:

user = webuser

group = webuser

 

启动php

/etc/init.d/php-fpm start

 

2.3.3      测试php

vi test.php

<?php
    phpinfo();
?>
 

 

mv test.php /usr/share/nginx/html/blog

 

访问http://域名/test.php

2.4  安装wordpress

mysql –uroot –p

create database wordpress;

 

访问http://域名/

相关文章
相关标签/搜索