LNMP架构基础搭建
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======== ...
随机推荐
- JS时间和字符串的相互转换 Date+String
1.js字符串转换成时间 1.1方法一:输入的时间格式为yyyy-MM-dd function convertDateFromString(dateString) { if (dateString) ...
- Basic Authentication in ASP.NET Web API
Basic authentication is defined in RFC 2617, HTTP Authentication: Basic and Digest Access Authentica ...
- CentOS 7 Fail2ban防暴力破解
1.安装 yum install epel-release -y yum install fail2ban fail2ban-systemd -y 2.配置 //新建配置 vim /etc/fail2 ...
- 在Mac中如何正确地设置JAVA_HOME
前期准备 下载JDK安装包:在JDK1.8下载中选择Mac的JDK安装包 安装JDK:这里只要按照安装指引一步一步安装即可 查找JAVA_HOME 打开Mac的终端,检查JDK是否安装成功:java ...
- Maximal Rectangle, 求矩阵中最大矩形,参考上一题
问题描述: Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1 ...
- java 获取今天,昨天,上个月的日期
获取今天,昨天,上个月的日期 的方法: Calendar cal = Calendar.getInstance(); //获取今天的日期 cal.setTime(new Date()); int ye ...
- 双击jar包运行方法
方案一 在jar包同级,写个bat文件,如下 java -jar Xxx.jar pause 方案二 右击jar文件 ->打开方式->选择安装的jre/bin/javaw.exe. 双击依 ...
- Python之坐标轴刻度细化、坐标轴设置、标题图例添加
学习python中matplotlib绘图设置坐标轴刻度.文本 http://www.jb51.net/article/134638.htm Python绘图 https://www.cnblogs. ...
- 010PHP基础知识——运算符(三)
<?php /** * 位运算符: * 1:&按位与:左右两边的数,同位都为1,返回是1,否则返回是0 */ /*$a = 5; $b = 6; $a = decbin($a);//10 ...
- C++复习14 构造函数初始化调用顺序
1.关于构造函数初始化调用顺序的问题. 首先是父类和子类的,首先调用父类的构造函数,然后调用子类的构造函数.但是对于子类中有其他类型的数据成员的时候,会在调用该类的构造函数之前,调用其数据成员的构造函 ...