YUM LNMP 安装 wordpress

1配置防火墙

Iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #允许80端口通过防火墙
iptables-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT #允许3306端口通过防火墙
service iptables save

2关闭SELINUX

Setgenfoce 0

vi /etc/selinux/config

#SELINUX=enforcing 
#SELINUXTYPE=targeted 
SELINUX=disabled

3卸载httpd php

yum remove httpd* php*

4安装并启动nginx

yum install nginx -y  #安装nginx 
chkconfig nginx on #设置nginx开机启动
service nginx start #启动nginx

5安装并启动mysql

yum install mysql mysql-server 
service mysqld start 
chkcongfig mysqld on
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

6为mysql设置密码

mysqladmin -uroot password mypassword

7为wordpress创建库

mysql -uroot -p mypassword

mysql>create database wordpress;
mysql>desc database;
mysql>Bye

8安装PHP

yum install -y php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt php php-fpm

9配置nginx

cp /etc/nginx/nginx.conf /etc/nginx/nginx.confbak
vi /etc/nginx/nginx.conf
   user nginx;

nginx.conf优化和上传的限制

worker_processes  8;
events {
use epoll;
worker_connections 65535;
}   
http {
include   mime.types;
default_type  application/octet-stream; 
client_max_body_size 100m;
client_header_buffer_size 128k;
large_client_header_buffers 4 128k;
sendfileon;
tcp_nopush on;
tcp_nodelay   on;
keepalive_timeout  65;
include /etc/nginx/vhost/*;
gzip  on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;

cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.confbak
vi /etc/nginx/conf.d/default.conf

index index.php index.html index.htm; 
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
解决固定连接404问题
location / {
root   /usr/local/www/nginx;
index  index.php index.html index.htm;
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;
}

}

service nginx restart

10配置PHP

vi /etc/php.ini

date.timezone = PRC 
expose_php = Off 
short_open_tag = ON 
open_basedir = .:

post_max_size = 20m
upload_max_filesize = 20M
max_file_uploads = 200

11配置php-fpm

cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.confbak
vi /etc/php-fpm.d/www.conf
   user = nginx
   group = nginx

cd /usr/share/nginx/html
vi index.php

<?php
phpinfo();
?>

访问你的网站/info.php测试

12安装wordpress

unzip wordpress-4.5.2-zh_CN.zip 
cd wordpress
cp -r ./* /usr/share/nginx/html/
cd /usr/share/nginx/html
cp wp-config-smaple.php wp-congfig.php
vi wp-config.php

define('DB_NAME', 'wordpress');

/** MySQL数据库用户名 */
define('DB_USER', 'root');

/** MySQL数据库密码 */
define('DB_PASSWORD', 'mypassword');

/** MySQL主机 */
define('DB_HOST', 'localhost');

/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');

/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');

13切换用户和权限

不做这步的话安装插件需要FTP服务
cd ../ 
chown -R html/*
chmod 755 html/* -R
或者也可以编辑wp-config.php
/** Override default file permissions */
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}

14访问你的网站/wp-admin按提示安装

原创文章,作者:双庆 李,如若转载,请注明出处:http://www.178linux.com/18034

(0)
上一篇 2016-06-22 15:49
下一篇 2016-06-22 16:15

相关推荐

  • Linux文本处理工具grep

    文件查看工具:cat     将[文件]或标准输入组合输出到标准输出。               -A, –show-all       &nbs…

    Linux干货 2016-08-10
  • Linux 第七天: (08月05日) 练习和作业

    Linux 第七天: (08月05日) 练习和作业       1 找出ifconfig命令结果中本机的所有IPv4地址 ifconfig | tr -cs '[0-9].''\n' | sort -ut '.' -k3 -n 或ifconfig | head -2 |…

    Linux干货 2016-08-08
  • 用户及权限管理

     今天是学习马哥教育第四天,也是第一个博客作业,写一篇关于用户及权限管理的简介型的博客文章,作文水品有限,所以写出来有可能有病句或者意境有问题,请大家多多包涵。  首先,用户及权限管理,需要从2方面入手来说,首先来说用户管理。  何谓用户,这是马哥一上来就提到的问题,我简单的理解,用户其实就是一个人机交互的接口,人机交互的接口是…

    Linux干货 2016-09-15
  • linux启动流程

    linux组成 Linux: kernel+rootfskernel: 进程管理、内存管理、网络管理、驱动程序、文件系统、安全功能 rootfs:程序和glibc库:函数集合, function, 调用接口(头文件负责描述)过程调用:procedure,无返回值函数调用:function程序:二进制执行文件 内核设计流派:单内核(monolithic ker…

    2018-01-01
  • N25期第一周作业

    计算机的组成与功能  一台能正常工作的计算机有硬件和软件组成,计算机的硬件就好比人的躯体,计算机的软件就好比人的思想,人的思想控制指挥人的躯体,计算机有了软件才能进行工作。 硬件大致由CPU,内存,输入输出设备,存储设备组成,各个部件的主要作用流程是:由输入设备(例如:键盘)输入数据, 数据暂时出入内存, 而后由内存传到CPU(CPU又由运算器+控…

    Linux干货 2016-12-05
  • ipvsadm配置命令

    Ipvsadm配置   ipvsadm/ipvs: 集群和集群之上的各RS是分开管理的; 集群定义 RS定义 ipvs:内核基本都自动编译上了 ~]# grep -i -C 10 “ipvs” /boot/config-VERSION-RELEASE.x86_64     支持的协议:…

    Linux干货 2017-05-17