l--操作系统:windows  linux  unix  mac OS

a--网页发布软件:apache nginx iis

m--数据库:mysql  pgsql  oracle...

p--网页语言:php  jsp  xml

配置:

系统环境: rhel6 x86_64 iptables and selinux disabled

主机: 192.168.122.185 server85.example.com

相关网址:wiki.nginx.org rpm.pbone.net

所需的包:mysql-5.6.10.tar.gz nginx-1.2.7.tar.gz libiconv-1.13.1.tar.gz libmcrypt-2.5.8.tar.bz2 mhash-0.9.9.9.tar.bz2 mcrypt-2.6.8.tar.gz php-5.4.12.tar.bz2

1.安装mysql

[root@server85
kernel]# tar zxf mysql-5.6.10.tar.gz

[root@server85
kernel]# cd mysql-5.6.10

[root@server85
mysql-5.6.10]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/lnmp/mysql \
(安装目录)

>
-DMYSQL_DATADIR=/usr/local/lnmp/mysql/data \ (数据库存放目录)

>
-DMYSQL_UNIX_ADDR=/usr/local/lnmp/mysql/data/mysql.sock \ (Unix
socket 文件路径)

>
-DWITH_MYISAM_STORAGE_ENGINE=1 \ (安装myisam存储引擎)

>
-DDEFAULT_CHARSET=utf8 \ (使用utf8字符)

>
-DDEFAULT_COLLATION=utf8_general_ci \ (校验字符)

>
-DEXTRA_CHARSETS=all \ (安装所有扩展字符集)

此时会出现如下问题:

(1)-bash:
cmake: command not found

(2)CMake
Error: CMAKE_C_COMPILER not set, after EnableLanguage

CMake
Error: CMAKE_CXX_COMPILER not set, after
EnableLanguage

(3)emove
CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is
libncurses5-dev, on Redhat and derivates it is ncurses-devel.

(4)Warning:
Bison executable not found in PATH

解决方法如下:

(1)[root@server85
mysql-5.6.10]# yum install cmake -y

(2)[root@server85
mysql-5.6.10]# yum install gcc gcc-c++ -y

(3)[root@server85
mysql-5.6.10]# yum install ncurses-devel -y

(4)[root@server85
mysql-5.6.10]# yum install bison -y

[root@server85
mysql-5.6.10]# make && make install

重新编译时,需要清除旧的对象文件和缓存信息:

[root@server85
mysql-5.6.10]# yum install make -y

[root@server85
mysql-5.6.10]# make clean

[root@server85
mysql-5.6.10]# rm -rf CMakeCache.txt

[root@server85
mysql-5.6.10]# useradd -u 27 -d /usr/local/lnmp/mysql/ -M mysql

[root@server85
mysql-5.6.10]# groupmod -g 27 mysql

[root@server85
mysql-5.6.10]# chown mysql.mysql -R /usr/local/lnmp/mysql/

[root@server85
mysql-5.6.10]# cp /usr/local/lnmp/mysql/support-files/my-default.cnf
/etc/my.cnf

[root@server85
mysql-5.6.10]# vim /etc/my.cnf

basedir
=
/usr/local/lnmp/mysql

datadir
= /usr/local/lnmp/mysql/data

port
= 3306

server_id
= 1

socket
= /usr/local/lnmp/mysql/data/mysql.sock

[root@server85
mysql-5.6.10]# cd /usr/local/lnmp/mysql/

[root@server85
mysql]# scripts/mysql_install_db
--user=mysql--basedir=/usr/local/lnmp/mysql/
--datadir=/usr/local/lnmp/mysql/data/

[root@server85
mysql]# cp support-files/mysql.server /etc/init.d/mysqld

[root@server85
mysql]# chown root -R /usr/local/lnmp/mysql/

[root@server85
mysql]# chown mysql -R /usr/local/lnmp/mysql/data/

[root@server85
mysql]# /etc/init.d/mysqld start

Starting
MySQL. SUCCESS! (看到此提示说明mysql启动成功)

[root@server85
mysql]# vim ~/.bash_profile

PATH=$PATH:$HOME/bin:$PATH:/usr/local/lnmp/mysql/bin

[root@server85
mysql]# source ~/.bash_profile

至此mysql安装完成!!!

2.安装及配置nginx

(1)安装:

[root@server85
kernel]# tar zxf nginx-1.2.7.tar.gz

[root@server85
kernel]# cd nginx-1.2.7

[root@server85
nginx-1.2.7]# vim src/core/nginx.h

#define
NGINX_VER "nginx" (编译后外界无法获取程序的版本号)

[root@server85
nginx-1.2.7]# vim auto/cc/gcc

#CFLAGS="$CFLAGS
-g"(去掉debug模式编译,编译以后程序只有几百k)

[root@server85 nginx-1.2.7]# ./configure
--prefix=/usr/local/lnmp/nginx --with-http_ssl_module
--with-http_stub_status_module

此时会出现如下错误:

(1)./configure:
error: the HTTP rewrite module requires the PCRE library.

(2)./configure:
error: SSL modules require the OpenSSL library.

解决方法如下:

(1)[root@server85
nginx-1.2.7]# yum install pcre-devel -y

(2)[root@server85
nginx-1.2.7]# yum install openssl-devel -y

[root@server85
nginx-1.2.7]# make && make install

[root@server85
nginx-1.2.7]# cd /usr/local/lnmp/nginx/conf/

[root@server85
conf]# vim nginx.conf

events
{

use epoll;

worker_connections
1024;

}

[root@server85
conf]# vim ~/.bash_profile

PATH=$PATH:$HOME/bin:$PATH:/usr/local/lnmp/mysql/bin: $PATH:/usr/local/lnmp/nginx/sbin

[root@server85
conf]# source ~/.bash_profile

[root@server85
conf]# nginx (启动nginx)

[root@server85
conf]# nginx -t ( 检测语法)

[root@server85
conf]# nginx -s reload (重载主配置文件)

[root@server85
conf]# nginx -s stop (关闭nginx)

访问server85.example.com能出现以下页面说明nginx安装并启动成功:

(2)配置(/etc/hosts下:192.168.122.185 server85.example.com)

[root@server85 ~]# useradd nginx

[root@server85 ~]# vim /usr/local/lnmp/nginx/conf/nginx.conf

user nginx nginx;

;

[root@server85 ~]# nginx -t

nginx: the configuration file /usr/local/lnmp/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/lnmp/nginx/conf/nginx.conf test is successful

[root@server85 ~]# nginx -s reload

[root@server85 ~]# ps ax

5922 ? Ss 0:00 nginx: master process nginx

5942 ? S 0:00 nginx: worker process

5943 ? S 0:00 nginx: worker process

5944 ? S 0:00 nginx: worker process

5945 ? S 0:00 nginx: worker process (进程数与配置的数目对应)

[root@server85
~]# vim /usr/local/lnmp/nginx/conf/nginx.conf

location /status {

stub_status
on;

access_log
off;

}

[root@server85
~]# nginx -s reload

访问server85.example.com出现以下页面说明配置成功:

HTTPS加密访问

[root@server85
~]# vim /usr/local/lnmp/nginx/conf/nginx.conf

server {

listen 443;

server_name
server85.example.com;

ssl
on;

ssl_certificate

nginx.pem;

ssl_certificate_key
nginx.pem;

ssl_session_timeout
5m;

ssl_protocols SSLv2
SSLv3 TLSv1;

ssl_ciphers
HIGH:!aNULL:!MD5;

ssl_prefer_server_ciphers
on;

location / {

root html;

index index.html
index.htm;

}

}

[root@server85
~]# cd /etc/pki/tls/certs/

[root@server85
certs]# make nginx.pem

Country
Name (2 letter code) [XX]:CN

State
or Province Name (full name) []:shannxi

Locality
Name (eg, city) [Default City]:xi'an

Organization
Name (eg, company) [Default Company Ltd]:westos

Organizational
Unit Name (eg, section) []:linux

Common
Name (eg, your name or your server's hostname)
[]:server85.example.com

Email
Address []:root@server85.example.com

[root@server85
certs]# mv nginx.pem /usr/local/lnmp/nginx/conf/

[root@server85
certs]# nginx -s reload

访问https://server85.example.com时需要先下载证书说明配置成功。

虚拟主机

[root@server85 ~]# vim /usr/local/lnmp/nginx/conf/nginx.conf

log_format main '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

server {

listen 80;

server_name www.linux.com;

access_log logs/linux.com.access.log main;

location / {

index index.html;

root /usr/local/lnmp/nginx/virtualhosts/linux;

}

}

server {

listen 80;

server_name www.westos.com;

access_log logs/westos.com.access.log main;

location / {

index index.html;

root /usr/local/lnmp/nginx/virtualhosts/westos;

}

}

[root@server85 ~]# cd /usr/local/lnmp/nginx/

[root@server85 nginx]# mkdir -p virtualhosts/linux

[root@server85 nginx]# mkdir -p virtualhosts/westos

[root@server85 nginx]# echo www.linux.com > virtualhosts/linux/index.html

[root@server85 nginx]# echo www.westos.com > virtualhosts/westos/index.html

[root@server85 nginx]# nginx -s reload

[root@server85 nginx]# vim /etc/hosts

192.168.122.185 www.linux.com www.westos.com

分别访问www.linux.com和www.westos.com能访问到不同的网页说明配置成功。

负载均衡

[root@server85
~]# vim /usr/local/lnmp/nginx/conf/nginx.conf

http
{

upstream
koen{

server
192.168.122.117:80;

server
192.168.122.1:80 ;

}

server
{

listen 80;

server_name
server85.example.com;

location / {

#
root html;

#
index index.html index.htm;

proxy_pass
http://koen ;

}

}

[root@server85
~]# nginx -s reload

访问server85.example.com,
刷新页面,两台机子上的页面循环出现说明配置成功.

至此nginx的安装及配置完毕!!!

3.安装php

libiconv
(加强系统对支持字符编码转换的功能)

[root@server85
kernel]# tar zxf libiconv-1.13.1.tar.gz

[root@server85
kernel]# cd libiconv-1.13.1

[root@server85
libiconv-1.13.1]# ./configure –libdir=/usr/local/lib64/

[root@server85
libiconv-1.13.1]# make && make install

libmcrypt
(php的加密算法扩展库)

[root@server85
kernel]# tar jxf libmcrypt-2.5.8.tar.bz2

[root@server85
kernel]# cd libmcrypt-2.5.8

[root@server85
libmcrypt-2.5.8]# ./configure –libdir=/usr/local/lib64/

[root@server85
libmcrypt-2.5.8]# make && make install

mhash
(php的加密算法扩展库)

[root@server85
kernel]# tar jxf mhash-0.9.9.9.tar.bz2

[root@server85
kernel]# cd mhash-0.9.9.9

[root@server85
mhash-0.9.9.9]# ./configure –libdir=/usr/local/lib64/

[root@server85
mhash-0.9.9.9]# make && make install

mcrypt

[root@server85
kernel]# tar zxf mcrypt-2.6.8.tar.gz

[root@server85
kernel]# cd mcrypt-2.6.8

[root@server85
mcrypt-2.6.8]# ./configure –libdir=/usr/local/lib64/

此时会出现如下错误:

configure:
error: *** libmcrypt was not found

解决方法如下:

[root@server85
mcrypt-2.6.8]# vim /etc/ld.so.conf

include
ld.so.conf.d/*.conf

/usr/local/lib64

[root@server85
mcrypt-2.6.8]# ldconfig

[root@server85
mcrypt-2.6.8]# make && make install

./configure时可能会报错:/bin/rm:cannot
remove 'libtoolT':No Such file or directory直接忽略.

php

[root@server85
kernel]# tar jxf php-5.4.12.tar.bz2

[root@server85
kernel]# cd php-5.4.12

[root@server85
php-5.4.12]# yum install net-snmp-devel curl-devel libxml2-devel
libpng-devel libjpeg-devel freetype-devel gmp-devel -y

[root@server85
php-5.4.12]# ./configure --prefix=/usr/local/lnmp/php
--with-config-file-path=/usr/local/lnmp/php/etc
--with-mysql=/usr/local/lnmp/mysql/ --with-openssl --with-snmp
--with-gd --with-zlib --with-curl --with-libxml-dir --with-png-dir
--with-jpeg-dir --with-freetype-dir --with-pear --with-gettext
--with-gmp --enable-inline-optimization --enable-soap --enable-ftp
--enable-sockets --enable-mbstring
--with-mysqli=/usr/local/lnmp/mysql/bin/mysql_config --enable-fpm
--with-fpm-user=nginx --with-fpm-group=nginx --with-libdir=lib64
--with-mcrypt –with-mhash

此时会出现以下错误:

checking
for MySQL support... yes

checking
for specified location of the MySQL UNIX socket... no

configure:
error: Cannot find libmysqlclient under /usr/local/lnmp/mysql/.

Note
that the MySQL client library is not bundled anymore!

解决方法如下:

[root@server85
php-5.4.12]# cd /usr/local/lnmp/mysql/

[root@server85
mysql]# ln -s lib/ lib64

[root@server85
php-5.4.12]# make ZEND_EXTRA_LIBS='-liconv'

[root@server85
php-5.4.12]# make install

[root@server85
kernel]# cd php-5.4.12/sapi/fpm/

[root@server85
fpm]# cp init.d.php-fpm /etc/init.d/php-fpm

[root@server85
~]# chmod +x /etc/init.d/php-fpm

[root@server85
~]# cd /usr/local/lnmp/php/etc/

[root@server85
etc]# cp php-fpm.conf.default php-fpm.conf

[root@server85
etc]# vim php-fpm.conf

pid
= run/php-fpm.pid

[root@server85
etc]# /etc/init.d/php-fpm start

[root@server85
etc]# ps ax

29876
? Ss 0:00 php-fpm: master process
(/usr/local/lnmp/php/etc/php-

29877
? S 0:00 php-fpm: pool www

29878
? S 0:00 php-fpm: pool www

[root@server85 etc]# vim /usr/local/lnmp/nginx/conf/nginx.conf

location
~ \.php$ {

root
html;

fastcgi_pass
127.0.0.1:9000;

fastcgi_index index.php;

#
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

include fastcgi.conf;

}

[root@server85
etc]# cd /usr/local/lnmp/nginx/html/

[root@server85
html]# vim index.php

<?php

phpinfo()

?>

[root@server85
html]# cd /root/kernel/php-5.4.12

[root@server85
php-5.4.12]# cp php.ini-production /usr/local/lnmp/php/etc/php.ini

[root@server85
php-5.4.12]# vim /usr/local/lnmp/php/etc/php.ini

date.timezone
= Asia/Shanghai

[root@server85
php-5.4.12]# /etc/init.d/php-fpm restart

[root@server85
php-5.4.12]# nginx -s reload

访问server85.example.com/index.php可以看到以下页面说明配置成功:

至此php安装完毕!!!

4.发布论坛

Discuz论坛:http://www.discuz.net/

phpwind论坛:http://www.phpwind.net/

phpbb论坛:https://www.phpbb.com/

[root@server85 kernel]# yum install unzip

[root@server85 kernel]# unzip Discuz_X2.5_SC_UTF8.zip -d /usr/local/lnmp/nginx/html/

[root@server85 kernel]# cd /usr/local/lnmp/nginx/html/

[root@server85 html]# rm -rf readme/ utility/

[root@server85 html]# mv upload/ bbs

[root@server85 html]# vim /usr/local/lnmp/nginx/conf/nginx.conf

location / {

root html;

index index.php index.html index.htm;

}

[root@server85 html]# nginx -s reload

访问server85.example.com/bbs出现以下画面,按“我同意”:

此时文件权限不满足要求:

解决方法如下:

[root@server85 bbs]# chown nginx -R /usr/local/lnmp/nginx/html/bbs/

至此Discuz论坛发布成功!!!

Rhel6-lanmp架构配置文档的更多相关文章

  1. MYSQL服务器my.cnf配置文档详解

    MYSQL服务器my.cnf配置文档详解 硬件:内存16G [client] port = 3306 socket = /data/3306/mysql.sock [mysql] no-auto-re ...

  2. 转!!Java代码规范、格式化和checkstyle检查配置文档

    为便于规范各位开发人员代码.提高代码质量,研发中心需要启动代码评审机制.为了加快代码评审的速度,减少不必要的时间,可以加入一些代码评审的静态检查工具,另外需要为研发中心配置统一的编码模板和代码格式化模 ...

  3. Hibernate配置文档详解

    Hibernate配置文档有框架总部署文档hibernate.cfg.xml 和映射类的配置文档 ***.hbm.xml hibernate.cfg.xml(文件位置直接放在src源文件夹即可) (在 ...

  4. Java代码规范、格式化和checkstyle检查配置文档

    http://www.blogjava.net/amigoxie/archive/2014/05/31/414287.html 文件下载: http://files.cnblogs.com/files ...

  5. Spring Hibernate4 整合配置文档

    1 applicationContext.xml配置文档 <?xml version="1.0" encoding="UTF-8"?><bea ...

  6. Kerberos主从配置文档

    Kerberos主从配置文档   1. Kerberos主从同步机制 在Master上通过以下命令同步数据: kdb5_util dump /var/kerberos/krb5kdc/slave_db ...

  7. python常用模块-配置文档模块(configparser)

    python常用模块-配置文档模块(configparser) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. ConfigParser模块用于生成和修改常见配置文档,当前模块的名称 ...

  8. azkaban编译安装配置文档

    azkaban编译安装配置文档 参考官方文档: http://azkaban.github.io/azkaban/docs/latest/ azkaban的配置文件说明:http://azkaban. ...

  9. Python学习 :常用模块(四)----- 配置文档

    常用模块(四) 八.configparser 模块 官方介绍:A configuration file consists of sections, lead by a "[section]& ...

随机推荐

  1. hdu 1081(最大子矩阵和)

    题目很简单,就是个最大子矩阵和的裸题,看来算法课本的分析后也差不多会做了.利用最大子段和的O(n)算法,对矩阵的行(或列)进行 i和j的枚举,对于第 i到j行,把同一列的元素进行压缩,得到一整行的一维 ...

  2. WebKit渲染基础(转载 学习中。。。)

    概述 WebKit是一个渲染引擎,而不是一个浏览器,它专注于网页内容展示,其中渲染是其中核心的部分之一.本章着重于对渲染部分的基础进行一定程度的了解和认识,主要理解基于DOM树来介绍Render树和R ...

  3. Java中的Double类型计算

    一.问题的提出: 如果我们编译运行下面这个程序会看到什么?public class Test{    public static void main(String args[]){        Sy ...

  4. 工作流学习——Activiti流程变量五步曲 (zhuan)

    http://blog.csdn.net/zwk626542417/article/details/46648139 ***************************************** ...

  5. VIM 打造 c/c++ IDE

    1. vim 的安装 $sudo apt-get install vim vim-scripts vim-doc <br> 其中vim-scripts包含了vim的一些基本插件,包括语法高 ...

  6. js 一些技巧

    转自 http://blog.csdn.net/lin49940/article/details/1703533 1. oncontextmenu="window.event.returnV ...

  7. tabhost切换标签:Log中出现You must supply a layout_width attribute的解决方法

    谷歌.百度该问题,发现,除非是真的忘记添加layout_height或者layout_width属性值,对于布局文件没有语法问题但又难以发现问题所在的情况,从自己的经历和一个帖子的说明看到,该错误多半 ...

  8. 打不开chm文件解决办法

    打不开chm文件解决办法.bat regsvr32 itss.dll /sregsvr32 hhctrl.ocx /s

  9. Structs1 -配置例子(转)

    转自:(http://blog.csdn.net/xys_777/article/details/7542095) Action, ActionForm, ActionForward ,这三个对象构成 ...

  10. linux笔记:压缩解压命令gzip,gunzip,tar,zip,unzip,bzip2,bunzip2

    命令名称:gzip功能:压缩文件命令所在路径:/bin/gzip用法:gzip 文件压缩后文件格式:.gz其他:压缩后不保留原文件:只能压缩文件,不能压缩目录 命令名称:gunzip功能:解压.gz格 ...