9.加大文件描述符
echo '*-nofile65535 ' >>/etc/security/limits.conf
10.设置/tmp权限为777 chmod 777 /tmp
网站集群架构开始1)web01==>LNMP动态网站搭建A.环境部署安装官方源的nginx服务
vim /etc/yum.repos.d/nginx.repo [nginx-stable]name=nginx stable repobaseurl=http://nginx.org/packages/centos/$releasever/$basearch/gpgcheck=1enabled=1gpgkey=https://nginx.org/keys/nginx_signing.key
yum install nginx -y systemctl start nginx systemctl enable nginx 安装mariadb数据库服务 yum install mariadb-server mariadb -y systemctl start mariadb.service systemctl enable mariadb.service 安装php-fpm
yum remove php-mysql php php-fpm php-commonrpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmyum install -y php71w php71w-cli php71w-common php71w-devel php71w-embeddedphp71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcachephp71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb
vim /etc/php-fpm.d/www.conf user = nginx group = nginx
systemctl startphp-fpm
B.搭建aaa.xxx.com下载指定软件包:
https://cn.wordPress/ target=_blank class=infotextkey>WordPress.org/download/
vim /etc/nginx/cond.f/blog.confserver{listen80;server_nameaaa.xxx.com;location/{root/usr/share/nginx/html/blog;indexindex.php index.html;}location ~ .php$ {root/usr/share/nginx/html/blog;fastcgi_pass127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}}
systemctl restart nginx
cd /usr/share/nginx/html/rz -y 选择软件包位置,进行传输tar xfwordpress-5.2.3-zh_CN.tar.gzmv wordpressblogrm -rfwordpress-5.2.3-zh_CN.tar.gzchown -R nginx.blog/
创建数据库信息
mysql -uroot -p123456create database wordpress;show databases;grant all on wordpress.* to 'wordpress'@'localhost'identified by '123456';select user,host from mysql.user;
本地解析hosts 在浏览器输入ip地址按步安装即可,输入对应的数据库名称及密码
aaa.xxx.com 同理2)web02==>动态网站实现https访问vim www.conf server {listen80;server_namewww.oldboy.com;rewrite^/(.*)$https://$host/$1 redirect;}server{listen443 ssl;server_namewww.oldboy.com;ssl_certificateserver.crt;ssl_certificate_keyserver.key;location/{root/usr/share/nginx/html/www/install_package;indexindex.php index.html;}location ~ .php$ {root/usr/share/nginx/html/www/install_package;fastcgi_pass127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}}
3)lb01/lb02==>nginx+keppalived负载均衡高可用负载均衡:
vim /etc/nginx/nginx.comusernginx;worker_processes1;error_log/var/log/nginx/error.log warn;pid/var/run/nginx.pid;events {worker_connections1024;}http {include/etc/nginx/mime.types;default_typeApplication/octet-stream;log_formatmain'$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';access_log/var/log/nginx/access.logmain;sendfileon;#tcp_nopushon;keepalive_timeout65;#gzipon;upstream oldboy {server172.16.1.7:80;}server{listen80;server_name localhost;location / {proxy_passhttp://oldboy;proxy_set_header Host$host;proxy_set_header X-Forwarded-For$remote_addr;proxy_next_upstream error timeout invalid_header http_404;}}}
本地解析10.0.0.5 aaa.xxx.com 高可用: 负载均衡环境准备
yum install -y keepalivedecho 'net.ipv4.ip_nonlocal_bind = 1' >>/etc/sysctl.confsysctl -pvim /etc/nginx/nginx.confserver {listen10.0.0.3:80;server_namelocalhost;systemctlrestart nginx
lb01:
vim /etc/keepalived/keepalived.conf! Configuration File for keepalivedglobal_defs {notification_email {acassen@firewall.locfailover@firewall.locsysadmin@firewall.loc }notification_email_from Alexandre.Cassen@firewall.locsmtp_server 192.168.200.1smtp_connect_timeout 30router_id lb01}vrrp_instance oldboy {state MASTERinterface eth0virtual_router_id 63priority 110advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.0.0.3}}
lb02
vim /etc/keepalived/keepalived.conf ! Configuration File for keepalivedglobal_defs {notification_email {acassen@firewall.locfailover@firewall.locsysadmin@firewall.loc}notification_email_from Alexandre.Cassen@firewall.locsmtp_server 192.168.200.1smtp_connect_timeout 30router_id lb02}vrrp_instance oldboy {state BACKUPinterface eth0virtual_router_id 63priority 100advert_int 1authentication {auth_type PASSauth_pass 1111}virtual_ipaddress {10.0.0.3}}
systemctl start keepalived.service
本地解析:10.0.0.3 脑裂及nginx服务停止保证主备转换:
推荐阅读
- 重装系统竟如此简单?你还在为这些事儿浪费时间吗
- CentOS7下部署滴滴云开源运维监控系统-Nightingale
- Linux世界——ssh登录安全简单介绍
- Linux下防御DDOS攻击的操作梳理
- 系统管理员不得不掌握的 9 个 kubectl 命令
- Linux系统常用的文件管理命令
- 在 Linux 上检查 MySQL/MariaDB 数据库正常运行时间的三种方法
- 简单实用的监控系统安装调试全过程,新手入门基础知识
- Win7系统一直提示盗版怎么办「系统天地」
- 一文带你彻底理解Linux的各种终端类型及概念