wordpress部署安装

二进制安装mysql8.0

# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.12-linux-glibc2.12-x86_64.tar
# tar xf mysql-8.0.12-linux-glibc2.12-x86_64.tar
# yum install -y libaio gcc-c++ lrzsz
# useradd -s /sbin/nologin -M mysql
# tar -xf mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz -C /application/
# cd /application/
# mv mysql-8.0.12-linux-glibc2.12-x86_64/ mysql
# mkdir /application/mysql/data
# chown mysql.mysql /application/mysql/data
# cd mysql
# ./bin/mysqld --initialize --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data/
# cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
# vim /etc/init.d/mysqld
basedir=/application/mysql
datadir=/application/mysql/data
# ln -s /application/mysql/bin/mysql /usr/bin/mysql
# vim /etc/my.cnf
[mysqld]
datadir = /application/mysql
datadir = /application/mysql/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /application/mysql/data/mysqld.pid
log-error = /var/log/mysqld.log
bind-address = 0.0.0.0
default_authentication_plugin=mysql_native_password  #远程连接
server-id = 1
log-bin = binlog
log-bin-index = binlog.index
expire_logs_days = 7
max_connections = 400
max_connect_errors = 1000
interactive_timeout = 1800
wait_timeout = 1800
tmp_table_size = 134217728
max_heap_table_size = 134217728
[mysql]
default-character-set = utf8
# /etc/init.d/mysqld start
# mysql -uroot -ppxRqK>FBi3:e
mysql> alter user 'root'@'localhost' identified with mysql_native_password BY 'password';
mysql> flush privileges;
mysql> use mysql
mysql> select host,user,authentication_string,plugin from user;
mysql> update user set host='%' where user='root';
mysql> create database wordpress;
mysql> create user 'wordpress'@'IP' identified by 'password';
mysql> grant all privileges on wordpress.* to 'wordpress'@'IP';

yum安装php7.0

# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
# yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysql php72w-opcache php72w-pdo php72w-xml
# systemctl start php-fpm
# systemctl enable php-fpm

编译安装nginx

# wget -c http://nginx.org/download/nginx-1.15.2.tar.gz
# tar xf nginx-1.15.2.tar.gz 
# cd nginx-1.15.2/
# useradd -M -s /sbin/nologin www
# yum install -y pcre-devel openssl-devel 
# ./configure --prefix=/application/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module
# make && make install
# vim /etc/profile
export PATH=$PATH:/application/nginx/sbin:$PATH
# source /etc/profile

安装wordpress

# wget https://wordpress.org/wordpress-4.9.8.tar.gz
# tar xf wordpress-4.9.8.tar.gz
# mv wordpress /application/nginx/html/
# cd /application/nginx/html/
# chown www.www -R wordpress/
# vim /application/nginx/conf/nginx.conf
user www www;
worker_processes  2;
worker_cpu_affinity 0101 1010;
worker_rlimit_nofile 65535;
events {
    use epoll;
    worker_connections  65535;
    multi_accept on;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    server_tokens off;
    tcp_nopush on;
    keepalive_timeout  65;
    tcp_nodelay on;
    open_file_cache max=102400 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 1;
    client_header_buffer_size 4k;
    client_header_timeout 15;
    client_body_timeout 15;
    client_max_body_size 10m;
    client_body_buffer_size 128k;
    reset_timedout_connection on;
    send_timeout 15;
    gzip on;
    gzip_min_length 2k;
    gzip_buffers    4 32k;
    gzip_http_version 1.1;
    gzip_comp_level 6;
    gzip_vary on;
    gzip_proxied any;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_connect_timeout 90;
    proxy_send_timeout 90;
    proxy_read_timeout 90;
    proxy_buffer_size 4k;
    proxy_buffers 4 32k;
    proxy_busy_buffers_size 64k;
    proxy_temp_file_write_size 64k;
    fastcgi_connect_timeout   300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;

    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  /application/nginx/logs/access.log  main;
      error_log   /application/nginx/logs/error.log     info;

      include /application/nginx/conf/conf.d/*.conf;
}
# mkdir /application/nginx/conf/conf.d  && cd /application/nginx/conf/conf.d
# vim wordpress.conf
server {
   listen 80 default_server;
   server_name _;
   server_tokens off;
   return 501;
}         
server {
   listen 80;
   server_name IP;
   server_tokens off;
   rewrite ^(.*)$ http://$host$1 permanent;
}      #禁止ip访问
server {
   listen 80;
   server_name www.wqblogs.com wqblogs.com;
   root  html/wordpress;
   index index.php index.html;
   client_header_timeout 120s;
   client_body_timeout 120s;
   client_max_body_size 100m;
   proxy_set_header X-Real-IP $remote_addr;
   if (-f $request_filename/index.html){
     rewrite (.*) $1/index.html break;
   }
   if (-f $request_filename/index.php){
     rewrite (.*) $1/index.php;
   }
   if (!-f $request_filename){
     rewrite (.*) /index.php;
   }
   location ~ \.php$ {
   root   html/wordpress;
   fastcgi_pass   127.0.0.1:9000;
   fastcgi_index  index.php;
   fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
   include        fastcgi_params;
   }      #连接php
   location ~* \.(ico|jpe?g|gif|png|bmp|swf|flv)$ {
     expires 30d;
     #log_not_found off;
     access_log off;
   }
   location ~* \.(js|css)$ {
   expires 7d;
   log_not_found off;
   access_log off;
   }
}

安装过程。。。。略

wordpress安装插件需要ftp问题

#chown -R www.www wordpress/
#vim wp-config.php
define("FS_METHOD","direct");
#vim  /etc/php-fpm.d/www.conf
user = www
group = www
#systemctl restart php-fpm

php-memcache插件

#wget https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
php-memcached插件
#wget https://github.com/php-memcached-dev/php-memcached/archive/php7.zip
#unzip php7.zip
#cd php-memcached-php7/
#phpize
#./configure --with-php-config=/usr/bin/php-config
#make && make install
#vim /etc/php.ini
[memcache]
extension_dir = "/usr/lib64/php/modules"
extension = "memcache.so"
extension = "memcached.so"
#systemctl restart php-fpm
点赞

发表评论

电子邮件地址不会被公开。

2 × 4 =