linux之lnmp安装wordpress简单总结
lnmp的环境有很多种安装方式,如:脚本安装,编译安装,yum安装,salt安装等百度一下就能找到。这里简单记录下。方便以后手动操作。
1.环境准备.
关闭防火墙,selinux
/etc/init.d/iptables stop sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config grep SELINUX=disabled /etc/selinux/config setenforce 0
系统优化
调整文件描述符
echo '* - nofile 100000 ' >>/etc/security/limits.conf
yum配置阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
安装环境依赖
yum -y install wget vim dstat screen rsync gcc gcc-c++ make autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel ntp libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel zip unzip ncurses-devel libevent libevent-devel pam-devel libiconv
2.安装nginx
useradd -s /sbin/nologin www -M wget http://nginx.org/download/nginx-1.10.3.tar.gz tar xf nginx-1.10.3.tar.gz && cd nginx-1.10.3 ./configure --prefix=/usr/local/nginx-1.10.3 --with-http_ssl_module --with-http_stub_status_module make && make install ln -s /usr/local/nginx-1.10.3 /usr/local/nginx
启动nginx
/usr/local/nginx/sbin/nginx
查看进程
[root@cool360.org ~]# netstat -lntp|grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 89112/nginx: master
启动成功.
3.安装php
php官网可以下载:http://php.net/downloads.php
or http://source.goyun.org:8000/source/PHP/
安装libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make make install
PHP扩展库
yum -y install libmcrypt-devel mhash mcrypt libmcrypt-devel
安装php
wget http://cn2.php.net/distributions/php-5.6.30.tar.gz tar xf php-5.6.30.tar.gz cd php-5.6.30/ ./configure --prefix=/usr/local/php5.6.30 --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline make &&make install ln -s /usr/local/php5.6.30/ /usr/local/php cp php.ini-development /usr/local/php/lib/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
启动php
/usr/local/php/sbin/php-fpm
php与nginx结合
nginx.conf中加入
include /usr/local/nginx/conf/vhost/*.conf;
域名解析+结合php
cat /usr/local/nginx/conf/vhost/blog.conf server { listen 80; server_name blog.cool360.org; # access_log /var/log/nginx/zentao_access.log main; root /app; location / { index index.php index.html index.htm; } location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } }
重启nginx
/usr/local/nginx/sbin/nginx -t /usr/local/nginx/sbin/nginx -s reload
测试下nginx
cd /app echo hello >index.html
浏览器访问:
http://10.20.23.219/
安装mysql
这里选择的是yum安装,当然也可以选择编译安装。
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm yum install mariadb mariadb-server mysql_install_db --user=mysql service mysql start mysqladmin -u root password
lnmp环境基本就准备好了,安装wordpress
- cd /app
- wget https://cn.wordpress.org/wordpress-4.5.1-zh_CN.tar.gz
- tar -xf wordpress-4.5.1-zh_CN.tar.gz
- chown www. -R *
接着就是浏览器的配置了
http://10.20.23.219/wordpress
按照提示一步一步操作
然后你就能看到
然后就可以各种优化你的博客了。
嗨、骚年、快来消灭0回复。