码迷,mamicode.com
首页 > 其他好文 > 详细

Wordpress安装部署

时间:2017-08-28 21:49:56      阅读:262      评论:0      收藏:0      [点我收藏+]

标签:wordpress

Wordpress 安装部署

1      前言

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

 

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

 

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

 

以下是wordpress安装部署方法。

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

2      安装部署

2.1  安装配置nginx

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://域名/

技术分享

技术分享

技术分享

技术分享

技术分享


本文出自 “桃子技术” 博客,请务必保留此出处http://taozijishu.blog.51cto.com/11320335/1960243

Wordpress安装部署

标签:wordpress

原文地址:http://taozijishu.blog.51cto.com/11320335/1960243

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!