Rhel6-lanmp架构配置文档
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架构配置文档的更多相关文章
- MYSQL服务器my.cnf配置文档详解
MYSQL服务器my.cnf配置文档详解 硬件:内存16G [client] port = 3306 socket = /data/3306/mysql.sock [mysql] no-auto-re ...
- 转!!Java代码规范、格式化和checkstyle检查配置文档
为便于规范各位开发人员代码.提高代码质量,研发中心需要启动代码评审机制.为了加快代码评审的速度,减少不必要的时间,可以加入一些代码评审的静态检查工具,另外需要为研发中心配置统一的编码模板和代码格式化模 ...
- Hibernate配置文档详解
Hibernate配置文档有框架总部署文档hibernate.cfg.xml 和映射类的配置文档 ***.hbm.xml hibernate.cfg.xml(文件位置直接放在src源文件夹即可) (在 ...
- Java代码规范、格式化和checkstyle检查配置文档
http://www.blogjava.net/amigoxie/archive/2014/05/31/414287.html 文件下载: http://files.cnblogs.com/files ...
- Spring Hibernate4 整合配置文档
1 applicationContext.xml配置文档 <?xml version="1.0" encoding="UTF-8"?><bea ...
- Kerberos主从配置文档
Kerberos主从配置文档 1. Kerberos主从同步机制 在Master上通过以下命令同步数据: kdb5_util dump /var/kerberos/krb5kdc/slave_db ...
- python常用模块-配置文档模块(configparser)
python常用模块-配置文档模块(configparser) 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. ConfigParser模块用于生成和修改常见配置文档,当前模块的名称 ...
- azkaban编译安装配置文档
azkaban编译安装配置文档 参考官方文档: http://azkaban.github.io/azkaban/docs/latest/ azkaban的配置文件说明:http://azkaban. ...
- Python学习 :常用模块(四)----- 配置文档
常用模块(四) 八.configparser 模块 官方介绍:A configuration file consists of sections, lead by a "[section]& ...
随机推荐
- Android布局_帧布局FrameLayout
一.FrameLayout布局概述 在这个布局中,所有的子元素都不能被指定放置的位置,他们统统放于这块区域的左上角,并且后面的子元素直接覆盖在前面的子元素之上,将前面的子元素部分和全部遮挡 如下面的 ...
- 启动eclipse说在sdk目录下的platforma-tools下面找不到adb.exe
adb是什么?adb有什么用?adb工具如何用? 是用来管理模拟器和真机的通用调试工具,该工具功能强大,直接打开cmd即可使用adb命令,adb的全称为Android Debug Bridge,是 ...
- php数据通信方式
一:curl$ch = curl_init();curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch,CURLOPT_TIMEOU ...
- graph-tool文档(一)- 快速开始使用Graph-tool - 3.图的过滤
目录: 图的过滤 图视图 -- 组合图视图 名词解释: filter:过滤 mask:屏蔽 inverted parameter:倒参数 overhead:开销 minimum spanning tr ...
- 小韦系统装工行网银U盾驱动的方法
小韦系统装工行网银U盾驱动的方法 拷贝文件.bat @echo 开始注册echo n|copy /-y scarddlg.dll %windir%\system32\echo n|copy /-y w ...
- 基于TBDS的flume异常问题排查过程
版权声明:本文由王亮原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/214 来源:腾云阁 https://www.qclou ...
- 华为面试题——约瑟夫问题的C++简单实现(循环链表)
/* author:jiangxin Blog:http://blog.csdn.net/jiangxinnju Function:method of Josephus que ...
- 简单的css居中问题(日常记录)
1.今天遇到了一个奇怪的问题:因为网页要适配大小分辨屏幕,需要把一张图片放到div中,我的初始思路是把图放在div中绝对对位给top50%left50%,但是不行,因为当网页调窄时图片就因为显得太大了 ...
- js时间显示设置
//对日期中部分小于10的数字前边添加0 function zero(s){ return s < 10 ? '0' + s: s; } var date=new Date(), year = ...
- OpenGL 简介
OpenGL是一个底层图形库规范.它为程序员提供了一个小的几何图元(点.线.多边形.图片和位图)库和一个支持2D/3D几何对象绘图命令库,通过所提供的图元和命令来控制对象的呈现(绘图). 由于Open ...