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星星评分控件RatingBar的使用
在Android的开发中,有一个叫做评分控件RatingBar,我们可以使用该控件做等级划分.评分等作用,星星形状显示,也可以半星级别,我们来看一下评分控件如何使用. 布局文件中定义控件以及属性,这里 ...
- android studio导入 so ,jar 文件。
环境为: Android Studio 1.0.2 如果是jar文件的话,请直接拷贝jar文件到项目的libs文件夹下,然后运行:Sync Project with Gradle Files.如下图2 ...
- LTIB常用命令3
http://blog.csdn.net/junht/article/details/7656540 LTIB 中的包 4.3.1 查看哪些包是使能的,并且可以安装 在配置ltib之前,您可以在一个 ...
- screenX clientX pageX的区别
screenX:鼠标位置相对于用户屏幕水平偏移量,而screenY也就是垂直方向的,此时的参照点也就是原点是屏幕的左上角. clientX:跟screenX相比就是将参照点改成了浏览器内容区域的左上角 ...
- 二级菜单jquery
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js二级导航
js写二级导航要点 1.ul li 2.js获取元素 3.setInterval(function(),time); 代码如下 <style type="text/css"& ...
- Ubuntu配置Open BlockChain
/* 以前只是听说过BlockChain,没怎么了解过,最近导师在搞Blockchain,让我配一下Open BlockChain的环境,于是就硬着头皮配了一下,还挺顺利的. 由于没接触过BlockC ...
- 368. Largest Divisible Subset -- 找出一个数组使得数组内的数能够两两整除
Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of ...
- UserAgent:通过浏览器获取用户浏览器等信息
User Agent的含义 User Agent中文名为用户代理,简称 UA,它是一个特殊字符串头,使得服务器能够识别客户使用的操作系统及版本.CPU 类型.浏览器及版本.浏览器渲染引擎.浏 ...
- java中将一个字符数组赋值给另一个,两者同时变化
java中将一个字符数组赋值给另一个,两者的变化怎么是同步的?怎么才能让他们独立开? 比如有一个int[][] a 已经存在值,现在定义int[][] b=a;之后改变a的值,为何b也跟着改变?怎么才 ...