LNMP架构+wordpress博客
环境:
- centos6.7 2.6.32-573.el6.x86_64
- nginx-1.6.3
- mysql-5.5.49
- php-5.3.27
- wordpress-4.9.4
Linux环境:
[root@web01 ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@web01 ~]# uname -m
x86_64
[root@web01 ~]# uname -r
2.6.32-573.el6.x86_64
[root@web01 ~]#
安装Nginx:
yum install pcre pcre-devel openssl openssl-devel -y
mkdir -p /home/oldboy/tools
cd /home/oldboy/tools
wget -q http://nginx.org/download/nginx-1.6.3.tar.gz
useradd nginx -s /sbin/nologin -M
tar xf nginx-1.6.3.tar.gz
cd nginx-1.6.3
./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.3 --with-http_stub_status_module --with-http_ssl_module
make
make install
ln -s /application/nginx-1.6.3 /application/nginx
cd ../
/application/nginx/sbin/nginx
lsof -i:80
安装MySQL:
cd /home/oldboy/tools/
rz
mysql-5.5.49-linux2.6-x86_64.tar.gz
useradd -s /sbin/nologin mysql -M
tar -xf mysql-5.5.49-linux2.6-x86_64.tar.gz
mv mysql-5.5.49-linux2.6-x86_64 /application/mysql-5.5.49
ln -s /application/mysql-5.5.49/ /application/mysql
cd /application/mysql
/bin/cp support-files/my-small.cnf /etc/my.cnf
chown -R mysql.mysql /application/mysql/
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
/etc/init.d/mysqld start
echo 'export PATH=/application/mysql/bin:$PATH' >>/etc/profile
source /etc/profile
mysqladmin -u root password '123456'
lsof -i:3306
安装PHP:
cd /home/oldboy/tools
rz
libtool-ltdl-devel-2.2.6-15.5.el6.x86_64.rpm
rpm -ivh libtool-ltdl-devel-2.2.6-15.5.el6.x86_64.rpm
yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -xf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ../
rpm -ivh http://mirrors.sohu.com/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
yum update
yum install libmcrypt-devel mhash mcrypt -y
rz
php-5.3.27.tar.gz
tar -xf php-5.3.27.tar.gz
cd php-5.3.27/
./configure \
--prefix=/application/php5.3.27 \
--with-mysql=/application/mysql \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--enable-rpath \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
touch ext/phar/phar.phar
make
make install
ln -s /application/php5.3.27/ /application/php
cp php.ini-production /application/php/lib/php.ini
cd /application/php/etc/
cp php-fpm.conf.default php-fpm.conf
/application/php/sbin/php-fpm
lsof -i:9000
上传wordpress:
mkdir /application/nginx/html/blog/ -p
cd /application/nginx/html/blog/
rz
wordpress-4.9.4.zip
unzip wordpress-4.9.4.zip
mv wordpress/* ./
rm -rf wordpress
chown -R nginx.nginx /application/nginx/html/blog/
编辑nginx配置文件,使用网站上线
grep -vE "#|^$" ./conf/nginx.conf.default >./conf/nginx.conf
[root@web01 nginx]# vim ./conf/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
incule extra/blog.conf;
}
[root@web01 nginx]# mkdir ./conf/extra
[root@web01 nginx]# vim ./conf/extra/blog.conf
[root@web01 conf]#
[root@web01 conf]# cat /application/nginx/conf/extra/blog.conf
server {
listen 80;
server_name blog.etiantian.org;
root html/blog;
index index.php index.html index.htm;
location / {
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|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
[root@web01 conf]#
使PHP程序连接数据库
cp /application/nginx/html/blog/wp-config-sample.php /application/nginx/html/blog/wp-config.php
[root@web01 conf]# vim /application/nginx/html/blog/wp-config.php
<?php
……
define('DB_NAME', 'wordpress');
/** MySQL database username */
define('DB_USER', 'wordpress');
/** MySQL database password */
define('DB_PASSWORD', '123456');
/** MySQL hostname */
define('DB_HOST', 'localhost');
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
……
创建数据库
mysql -uroot -p123456
mysql>create database wordpress;
mysql>grant all on wordpress.* to wordpress@'localhost' identified by '123456';
mysql>flush privileges;
mysql> quit
重启nginx使WEB服务生效
/application/nginx/sbin/nginx -t
/application/nginx/sbin/nginx -s reload
测试:
浏览器输入:http://blog.etiantian.org/wp-admin/install.php
LNMP架构基础搭建的更多相关文章
-
LNMP架构的搭建
第9章 LNMP架构的搭建 9.1 什么是LNMP 9.1.1 LNMP的组成 L linux N nginx:实现静态的服务处理 M ...
-
Linux:LNMP架构的搭建
LNMP架构的搭建 centos6.8-i686 MySQL PHP Nginx 搭建前先安装一些必要的rpm和php组件(全新系统) yum install -y wget gcc vim* lib ...
-
第十一章 LNMP架构基础介绍
一.LNMP架构 1.简介 oLNMP是一套技术的组合,L=Linux.N=Nginx.M~=MySQL.P~=PHP不仅仅包含这些,还有redis/ELK/zabbix/git/jenkins/ka ...
-
s28 LNMP架构服务搭建
nginx-location使用 location语法 location使用的语法例子为: location [=|~|~*|^~] uri{ 对location语法列表说明. |1ocation | ...
-
LNMP架构之搭建wordpress博客网站
系统环境版本 [root@db02 ~]# cat /etc/redhat-release CentOS release 6.9 (Final) [root@db02 ~]# uname -a Lin ...
-
LNMP架构下Discuz论坛的搭建
在上一节中,我们对lnmp架构下的mysql.php.nginx进行源码的安装,并设置了相关的安装参数.现在我们将在上一节的基础上,把三者联系起来进行一个论坛的部署. 一.首先进行Discuz(社区论 ...
-
企业级LNMP架构搭建实例(基于Centos6.x)
1.1 部署LNMP架构说明 1.1.1 LNMP架构内容 01.部署linux系统 02.部署nginx网站服务 03.部署mysql数据库服务 04.部署php动态解析服务 1.1.2 配置LNM ...
-
puppet自动化搭建lnmp架构
puppet自动化安装lnmp架构 3nginx的搭建 mkdir -p /etc/puppet/modules/nginx/{manifests,files} vim /etc/puppet/mod ...
-
部署企业LNMP架构搭建bbs
部署企业LNMP架构 1===============部署Nginx 2===============安装及部署Mysql数据库 3===============安装PHP解析环境 4======== ...
随机推荐
-
[转]win 10 开始菜单(Win 7风格)增强工具 StartIsBack++ v1.3.4 简体中文特别版
Windows10开始菜单增强工具StartIsBack++现已更新至v1.3.4,最近主要修复在Win10周年更新版上恢复睡眠后任务栏通知中心按钮消失的问题.升级版对StartIsBack+全新构建 ...
-
angular 解析html
方法1:写filter <div ng-bind-html="showContent | html" class="detail-content"> ...
-
【linux】内核编译
原创,转载时请注明,谢谢.邮箱:tangzhongp@163.com 博客园地址:http://www.cnblogs.com/embedded-tzp Csdn博客地址:http://blog.cs ...
-
Phplot--一些记录
1.一张图片画俩次 需要设置 $phplot->SetPrintImage(0); 参考 http://www.phplot.com/phplotdocs/ex-twoplot1.html
-
项目管理利器maven学习笔记(一):maven介绍及环境搭建
maven介绍 maven下载与环境搭建 http://maven.apache.org/download.cgi# 解压到指定位置,比如我解压到D盘 设置maven环境变量 添加一个变量名,变量值为 ...
-
解决layui下拉选择框只能选择不能手动输入文字
审查元素可以看到,layui的select下拉框是用input和div模拟出来的,所以,如下例子,我的解决方法是:$('.mySelect').find('input').removeAttr(&qu ...
- 第七章 二叉搜索树 (d1)AVL树:重平衡
-
UESTC 485 Game(康托展开,bfs打表)
Game Time Limit: 4000/2000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status t ...
-
mysqldump 和 sql命令导入sql文件
注意:不是进入mysql命令行操作的::: mysqldump -uroot -p --database x3gbk >x3gbk.sql 回车会出发,输入密码; 直接在-p后输入密码,有时候这 ...
-
C++ std::unordered_map
std::unordered_map template < class Key, // unordered_map::key_type class T, // unordered_map::ma ...