服务部署--集部署

服务部署--集部署
这⾥写⽬录标题
搭建服务
搭建该服务的所需环境
1. 先⾏搭建LNMP-All in One
(IP:188.188.188.180)
2. 搭建分离LNMP
(php-IP:188.188.188.188;nginx-ip:188.188.188.189;mysql-ip:188.188.188.190)
3. 搭建两台静态apache服务器
(apache-1-IP:172.169.25.253;apache-2-IP:172.169.25.254)
4. 搭建Nginx负载均衡,配置⽂件设置IP不可访问,动态为两组LNMP,静态为俩组apache。与三个⽹段建⽴连接
(Nginx-IP-1:192.168.1.2 、Nginx-IP-2:188.188.188.250、Nginx-IP-3:172.169.25.250)
5. DNS服务配置正向解析
(DNS-IP-1:192.168.1.10)
6. 客户端访问
(IP:192.168.1.20)
实现思路
1.在搭建好所有环境之后,将两组LNMP放在同⼀个⽹段中(188.188.188.0),配置页⾯全部⽆误,放⾏端⼝,相互访问⽆误。
它的作⽤是提供动态页⾯
2. 搭建两台apache服务器后(172.169.25.0),配置静态页⾯内容
它的作⽤是提供静态页⾯
3. 搭建Nginx负载均衡服务器后,设置三个⽹段,分别连接三种不同的服务,将这个服务配置与两种页⾯链接的内容,重启服务,放⾏端⼝后,进⾏访问,⽆误后进⾏下⼀步。
它的作⽤是在其他⽹段访问时,提供这两种不同⽹段的不同页⾯
4. 搭建DNS服务器,设置正向解析,本机使⽤域名访问,成功后便可使⽤客户端通过域名访问。
它的作⽤是将Nginx负载均衡的IP解析成为域名,使得客户端即使不使⽤IP便可访问到Nginx负载均衡
服务器
搭建步骤
⼀、搭建LNMP-All in One
先预先装上所需要的环境和包
[root@zjx-0703-LNMP ~]# yum -y install gcc* ncurses-devel bison cmake
[root@zjx-0703-LNMP ~]# yum -y install gd libxml2-devel libjpeg-devel libpng-devel
[root@zjx-0703-LNMP ~]# yum -y install pcre* openssl*
mysql安装
[root@zjx-0703-LNMP ~]# tar -zxvf mysql-5.5. -C /usr/src/
[root@zjx-0703-LNMP ~]# cd /usr/src/mysql-5.5.22/
[root@zjx-0703-LNMP mysql-5.5.22]# cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql  -DSY
SCONFDIR=/etc/  -DDEFAULT_CHARSET=utf8  -DDEF AULT_COLLATION=utf8_general_ci  -DWITH_EXTRA_CHARSETS=all
[root@zjx-0703-LNMP mysql-5.5.22]# make
[root@zjx-0703-LNMP mysql-5.5.22]# make install
[root@zjx-0703-LNMP mysql-5.5.22]# ln -s /usr/local/mysql/bin/* /usr/local/bin/
[root@zjx-0703-LNMP mysql-5.5.22]# useradd -s /sbin/nologin -M mysql
[root@zjx-0703-LNMP mysql-5.5.22]# chown -R mysql:mysql /usr/local/mysql/
[root@zjx-0703-LNMP mysql-5.5.22]# cp /usr/local/mysql/support-files/my-mediumf /etc/myf
[root@zjx-0703-LNMP mysql-5.5.22]# cd /usr/local/mysql/
[root@zjx-0703-LNMP mysql]#  scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
变压器油泵# 命令结果显⽰两个OK,成功
Installing MySQL
OK
高速路收费系统
Filling
OK
......
# 在profile⽂件中加⼊MySQL变量,并刷新内容,使其⽣效
[root@zjx-0703-LNMP mysql]# vim /etc/profile
PATH=$PATH:/usr/local/mysql/bin
[root@zjx-0703-LNMP mysql]# source /etc/profile
[root@zjx-0703-LNMP mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
[root@zjx-0703-LNMP mysql]# chmod +x /etc/rc.d/init.d/mysqld
[root@zjx-0703-LNMP mysql]# chkconfig --add mysqld
[root@zjx-0703-LNMP mysql]# systemctl restart mysqld
安装php
# 安装三个所需依赖包
[root@zjx-0703-LNMP mysql]# cd
[root@zjx-0703-LNMP ~]# tar zxvf libmcrypt-2.5. -C /usr/src/
[root@zjx-0703-LNMP ~]# cd /usr/src/libmcrypt-2.5.8/
[root@zjx-0703-LNMP libmcrypt-2.5.8]# ./configure && make && make install
[root@zjx-0703-LNMP libmcrypt-2.5.8]# ln -s /usr/local/lib/libmcrypt.* /usr/lib
[root@zjx-0703-LNMP libmcrypt-2.5.8]# cd
[root@zjx-0703-LNMP ~]# tar zxvf mhash-0.9.9. -C /usr/src/
[root@zjx-0703-LNMP ~]# cd /usr/src/mhash-0.9.9.9/
[root@zjx-0703-LNMP mhash-0.9.9.9]# ./configure && make -j 4 && make install
[root@zjx-0703-LNMP mhash-0.9.9.9]#  ln -s /usr/local/lib/libmhash..* /usr/lib
[root@zjx-0703-LNMP mhash-0.9.9.9]#  cd
[root@zjx-0703-LNMP ~]#  tar zxvf mcrypt-2.6. -C /usr/src/
[root@zjx-0703-LNMP ~]# cd /usr/src/mcrypt-2.6.8/
[root@zjx-0703-LNMP mcrypt-2.6.8]# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
[root@zjx-0703-LNMP mcrypt-2.6.8]# ./configure && make -j 4 && make install
安装php并进⾏配置
[root@zjx-0703-LNMP mcrypt-2.6.8]#  cd
[root@zjx-0703-LNMP ~]# tar -zxvf php-5.3. -C /usr/src/
[root@zjx-0703-LNMP ~]# cd /usr/src/php-5.3.28/
[root@zjx-0703-LNMP ~]# ./configure  --prefix=/usr/local/php  --with-gd --with-zlib  --with-mysql=mysqlnd  --with-pdo-mysql=mysqlnd  --with-mysqli=mysqln d  --with-config-file-path=/usr/local/php  --enable-fpm  --enable-mbstring  --with-jpeg-dir=/usr/lib
[root@zjx-0703-LNMP ~]# make && make install
[root@zjx-0703-LNMP php-5.3.28]# cp php.ini-development /usr/local/php/php.ini
# php.ini⽂件中到并修改以下内容
[root@zjx-0703-LNMP php-5.3.28]# vim /usr/local/php/php.ini
default_charset ="utf-8"
short_open_tag = On
[root@zjx-0703-LNMP php-5.3.28]# cp /usr/src/php-5.3.28/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[root@zjx-0703-LNMP php-5.3.28]# chmod +x /etc/init.d/php-fpm
[root@zjx-0703-LNMP php-5.3.28]# chkconfig --add php-fpm
[root@zjx-0703-LNMP php-5.3.28]# cd /usr/local/php/etc/
[root@zjx-0703-LNMP etc]# f.f
# f配置⽂件中到并修改以下内容
[root@zjx-0703-LNMP etc]# f
# 去注释
pid = run/php-fpm.pid
......
# 改参数
pm.max_children = 50
......
pm.start_servers = 20
......
pm.min_spare_servers = 5背心袋
......
pm.max_spare_servers = 35
安装php模块
[root@zjx-0703-LNMP etc]# cd
[root@zjx-0703-LNMP ~]# tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_ -C /usr/src/
[root@zjx-0703-LNMP ~]# cd /usr/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/
[root@zjx-0703-LNMP php-5.3.x]# cp ZendGuardLoader.so /usr/local/php/lib/php/
[root@zjx-0703-LNMP php-5.3.x]# systemctl restart php-fpm
安装nginx
[root@zjx-0703-LNMP ~]# tar zxvf nginx-1.6. -C /usr/src/
[root@zjx-0703-LNMP ~]#  cd /usr/src/nginx-1.6.2/
[root@zjx-0703-LNMP nginx-1.6.2]#  ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_spdy_module --with -http_stub_status_module --with-pcre
[root@zjx-0703-LNMP nginx-1.6.2]#  make && make install
[root@zjx-0703-LNMP nginx-1.6.2]# useradd -r -s /sbin/nologin nginx
[root@zjx-0703-LNMP nginx-1.6.2]# cd /usr/local/nginx
[root@zjx-0703-LNMP nginx]# ln -s /usr/local/nginx/sbin/nginx /usr/sbin/
# f配置⽂件中到并修改以下内容
[root@zjx-0703-LNMP nginx]# vim /usr/local/nginx/f
user  nginx;
worker_processes  1;
#error_log  logs/error.log;
error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
pid        logs/nginx.pid;
重启nginx并访问
[root@zjx-0703-LNMP nginx]# nginx -t
# 出现这些为成功,如果出错,根据报错内容进⾏修改
nginx: the configuration file /usr/local/nginx/f syntax is ok
nginx: configuration file /usr/local/nginx/f test is successful金银卡纸
[root@zjx-0703-LNMP nginx]# nginx
人防堵漏
[root@zjx-0703-LNMP nginx]# firefox 127.0.0.1
当你看到该内容时,说明你已经安装成功,接下来进⾏平滑升级
[root@zjx-0703-LNMP ~]# tar zxvf nginx-1.11. -C /usr/src/
[root@zjx-0703-LNMP ~]# cd /usr/src/nginx-1.11.5/
[root@zjx-0703-LNMP nginx-1.11.5]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module && make
[root@zjx-0703-LNMP nginx-1.11.5]# cd /usr/local/nginx/sbin/
[root@zjx-0703-LNMP sbin]# mv nginx /usr/local/sbin/nginx_old
[root@zjx-0703-LNMP sbin]# cd /usr/src/nginx-1.11.5/objs/
[root@zjx-0703-LNMP objs]# cp nginx /usr/local/nginx/sbin/
[root@zjx-0703-LNMP objs]# kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
# f配置⽂件到并修改
[root@zjx-0703-LNMP objs]# vim /usr/local/nginx/f
#location ~ \.php$ {
#    proxy_pass  127.0.0.1;
#}
location /status{
stub_status on;
access_log off;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
[root@zjx-0703-LNMP objs]# nginx -s reload
[root@zjx-0703-LNMP objs]# firefox 127.0.0.1/status
当你看到这个页⾯说明成功
接下来开始静态页⾯的配置
[root@zjx-0703-LNMP ~]# vim /usr/local/nginx/f
# 到并修改下⽅内容
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root          /www;
数据线接头fastcgi_pass  188.188.188.180:9000;
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
include        f;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one

本文发布于:2024-09-23 00:38:14,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/1/290695.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:内容   配置   服务   搭建   访问
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议