标签:tco map gad bcd 解析 ycm ddl fhs crc
这四种软件均为免费开源软件,组合到一起,成为一个免费、高效、扩展性强的网站服务系统。
特点:
Hostname
|
OS
|
IP
|
Software
|
LNMP.test.com
|
CentOS6.5-x86_64
|
172.16.1.111
|
pcre-devel/zlib-devel/gd/libxml2-devel/libjpeg-devel/libpng-devel/nginx-1.6.3.tar.gz/cmake-2.8.5.tar.gz/mysql-5.5.22.tar.gz/ php-5.3.28.tar.gz |
1.安装配置Nginx服务
## 安装pcre-devel、zlib-devel支持包 ##
[root@ LNMP ~]# yum install -y pcre-devel zlib-devel ## 创建运行用户nginx ## [root@ LNMP ~]# useradd -M -s /sbin/nologin nginx ## 解压安装Nginx ## [root@ LNMP ~]# tar zxvf /opt/nginx-1.6.0.tar.gz -C /usr/src/ [root@ LNMP ~]# cd /usr/src/nginx-1.6.0/ [root@LNMP nginx-1.6.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module [root@ LNMP nginx-1.6.0]# make && make install
## 优化执行路径 ## [root@ LNMP ~]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin/ [root@rhel6 ~]# nginx –t //测试是否安装正确 [root@rhel6 ~]# nginx // 启动服务 [root@rhel6 ~]# netstat -anpt |grep nginx //查看端口 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 13440/nginx [root@rhel6 ~]# elinks http://192.168.1.226 测试网页
2.安装配置Mysql服务
yum -y install ncurses-devel ## 安装配置cmake ## [root@LNMP ~]# tar zxvf /opt/cmake-2.8.6.tar.gz -C /usr/src/ [root@LNMP ~]# cd /usr/src/cmake-2.8.6/ [root@LNMP cmake-2.8.6]# ./configure && gmake && gmake install ## 创建mysql运行用户 ## [root@LNMP ~]# useradd -M -s /sbin/nologin mysql ## 安装配置Mysql ## [root@LNMP ~]# tar zxvf /opt/mysql-5.5.22.tar.gz -C /usr/src/ [root@LNMP ~]# cd /usr/src/mysql-5.5.22/ [root@LNMP mysql-5.5.22]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc [root@LNMP mysql-5.5.22]# make && make install
## 生成主配置文件 ## [root@LNMP ~]# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf cp: overwrite `/etc/my.cnf‘? y ## 更改目录属主属组 ## [root@LNMP ~]# chown -R mysql.mysql /usr/local/mysql/ ## 初始化数据库 ## [root@LNMP ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ ## 添加环境变量 ## [root@LNMP ~]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile [root@LNMP ~]# source /etc/profile ## 将mysql添加到系统服务 ## [root@LNMP ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld [root@LNMP ~]# chmod 75 /etc/init.d/mysqld [root@LNMP ~]# chkconfig --add mysqld [root@LNMP ~]# chkconfig mysqld on ## 启动服务并查看监听信息 ## [root@LNMP ~]# service mysqld start Starting MySQL.... [ OK ] [root@LNMP ~]# netstat -anpt | grep ":3306" tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 72223/mysqld ## 设置Mysql密码 ## [root@LNMP ~]# mysqladmin -u root password ‘aptech‘
3.安装配置PHP解析
yum -y install gd libxml2 libxml2-devel libjpeg-devel libpng-devel ## 解压安装PHP ## [root@LNMP ~]# tar zxvf /opt/php-5.3.28.tar.gz -C /usr/src/ [root@LNMP ~]# cd /usr/src/php-5.3.28/ [root@LNMP php-5.3.28]# ./configure --prefix=/usr/local/php --with-gd --with-zlib --with-mysql=/usr/local/mysql/ --with-config-file-path=/usr/local/php --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib [root@LNMP php-5.3.28]# make && make install ## 优化php执行路径 ## [root@LNMP ~]# ln -s /usr/local/php/bin/* /usr/local/bin/ [root@LNMP ~]# ln -s /usr/local/php/sbin/* /usr/local/sbin/ 4.配置Nginx支持PHP ## 生成PHP主配置文件并进行修改 ## [root@LNMP ~]# cd /usr/local/php/etc/ [root@LNMP etc]# cp php-fpm.conf.default php-fpm.conf [root@LNMP etc]# useradd -M -s /sbin/nologin php
[root@LNMP etc]# vim php-fpm.conf pid = run/php-fpm.pid //确认pid文件位置 user = php //运行用户改为php group = php //运行组改为php pm.start_servers = 20 //启动时开启的进程数 pm.min_spare_servers = 5 //最小空闲进程数 pm.max_spare_servers = 35 //最大空闲进程数 pm.max_children = 50
## 修改Nginx服务脚本 ## 四、配置Nginx 支持PHP环境 1、修改Nginx服务脚本,以便在启动、停止Nginx服务时将php-fpm进程启动、停止 [root@rhel6 ~]# vim /etc/init.d/nginx (参考脚本nginx.initscript) #!/bin/bash # chkconfig: 35 99 20 # description: Nginx Service Control Script PROG="/usr/local/nginx/sbin/nginx" PROG_FPM="/usr/local/sbin/php-fpm" PIDF="/usr/local/nginx/logs/nginx.pid" PIDF_FPM="/usr/local/php5/var/run/php-fpm.pid" case "$1" in start) $PROG $PROG_FPM ;; stop) kill -s QUIT $(cat $PIDF) kill -s QUIT $(cat $PIDF_FPM) ;; restart) $0 stop $0 start ;; reload) kill -s HUP $(cat $PIDF) ;; *) echo "Usage: $0 {start|stop|restart|reload}" exit 1 esac exit 0 [root@rhel6 ~]# chmod a+x /etc/init.d/nginx
2、配置Nginx支持PHP解析
[root@rhel6 ~]# vim /usr/local/nginx/conf/nginx.conf 45 index index.html index.php; 65 location ~ \.php$ { 66 root /var/www/benet; 67 fastcgi_pass 127.0.0.1:9000; 68 fastcgi_index index.php; 70 include fastcgi.conf; 71 }
LNMP 测试: [root@rhel6 ~]# vim /var/www/benet/test.php <?php $link=mysql_connect(‘localhost‘,‘root‘,‘666666‘); //单引号 if($link) echo "恭喜你,数据库连接成功!"; mysql_close(); ?>
[root@rhel6 ~]# vim /var/www/benet/testphpinfo.php <?php phpinfo(); ?>
五、安装部署电影服务器
[root@rhel6 benet]# mysql -u root -p mysql> create database skyucdb; [root@rhel6 benet]# tar -jxvf SKYUC_3.2.2_Free_For_PHP5.3.tar.bz2 [root@rhel6 ~]# cp -ap SKYUC_3.2.2_Free_For_PHP5.3/wwwroot/* /var/www/benet/ [root@rhel6 wwwroot]# cd /var/www/benet/ [root@rhel6 benet]# chmod -R 777 data/ [root@rhel6 benet]# chmod -R 777 templates/ [root@rhel6 benet]# chmod -R 777 admincp/ [root@rhel6 benet]# chmod -R 777 upload/
标签:tco map gad bcd 解析 ycm ddl fhs crc
原文地址:http://www.cnblogs.com/baishuchao/p/5991779.html