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

相关推荐

  • 马哥教育网络班21期第六周作业

    详细总结VIM编辑器的使用并完成以下练习题 1、复制/etc/rc.d/rc.sysinit文件至/tmp目录,将/tmp/rc.sysinit文件中的以至少一个空白字符开头的行的行首加# cp /etc/rc.d/rc.sysinit /tmp vim /tmp/rc.sysinit :%s/^[[:space:]]\+/#/…

    Linux干货 2016-08-22
  • 系统自动化安装

    本章内容 系统安装过程配置anaconda自动化安装系统 安装程序 CentOS系统安装 系统启动流程: bootloader–>kernel(initramfs)–>rootfs–>/sbin/init anaconda: 系统安装程序 tui: 基于图形库curses的文本窗口 gui:图形窗口 安装程序启动过程 MBR…

    Linux干货 2016-09-19
  • 基于heartbeat v2 crm实现基于nfs的mysql高可用集群

    前言 因heartbeat v1内置的资源管理器haresource功能比较简单,且不支持图形化管理,所以heartbeat v2不再支持haresource,转而使用更加强大的资源管理器crm进行集群管理。本文将讲解如何基于heartbeat v2 crm实现基于nfs的mysql高可用集群。 高可用实现 实验拓扑 实验环境 node1:172.16.10…

    Linux干货 2015-06-11
  • vim必掌握用法

    vim最入门用法大全

    Linux干货 2017-12-03
  • N22-妙手-第九周课程练习

    1、写一个脚本,判断当前系统上所有用户的shell是否为可登录shell(即用户的shell不是/sbin/nologin);分别这两类用户的个数;通过字符串比较来实现;: #!/bin/bash # declare -i numberOfLoginUser=0 declare -i numberOfUnloginUs…

    Linux干货 2016-10-19
  • 软件包管理

    rpm 与 yum 的用法 源代码:name-VERSION.tar.gz|bz2|xz VERSION: major.minor.release rpm包命名方式: name-VERSION-release.arch.rpm 例:bash-4.2.46-19.el7.x86_64.rpm VERSION: major.minor.release rele…

    Linux干货 2016-09-01