平滑升级
从官网下载一个新版本的nginx源码包并解压
解压12[root@localhost ~]# tar zxf nginx-1.13.7.tar.gz[root@localhost ~]# cd nginx-1.13.7/
编译1[root@localhost nginx-1.13.7]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx && make
此处不需要make install
备份配置文件12[root@localhost nginx-1.13.7]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old[root@localhost nginx-1.13.7]# mv /usr/local/ngi ...
地址重写
修改配置文件12345vi /usr/local/nginx/conf/nginx.conf在server模块location下添加: if ($host != "www.one.com") { rewrite ^/(.*)$ http://www.two.com/hello.html permanent; }
解释:如果客户端访问www.one.com则会跳转到www.two.com/hello.html页面中
重载服务1nginx -s reload
Nginx源码安装
安装依赖1yum -y install openssl* pcre*
openssl:如果在数据进行传输的过程中,没有加密认证,发送的数据很容易被抓包工具获取,容易暴露信息,openssl用于使用证书将传送的数据进行加密保证数据安全,通常要去网站配置ssl证书,实现https协议pcre:为了支持rewrite,实现url的重定向,根据正则表达式进行内容跳转,跳转到指定的目标
解压源码包1tar zxf nginx-1.11.1.tar.gz
编译安装12cd /usr/src/nginx-1.11.1./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_spdy_module --with-http_stub_status_module --with-pcre && make && make instal ...
KVM-Virsh指令
查看kvm服务器信息1virsh nodeinfo {test}
查看虚拟机和状态1virsh list --all
查看指定虚机信息1virsh dominfo {test}
列出虚拟网络1virsh net-list [--all]
启动该虚拟机1virsh start {test}
重启虚拟机1virsh reboot {test}
挂起虚拟机1virsh suspend {test}
虚拟机唤醒(取消挂起)1virsh resume {test}
关闭虚拟机1virsh shutdown {test} # 系统提示正在被关闭,却未必能成功
强制关闭虚拟机1virsh destroy {test}
虚机开机自启1virsh autostart {test}
取消开机自启1virsh autostart --disable {test}
将该虚拟机的运行状态存储到文件a ...
KVM
环境准备检查该服务器是否支持虚拟化,尤其是cpu,这里如果没有输出则需要进入BIOS去调整cpu的虚拟化,具体百度即可,虚拟机则很方便在虚拟机设置里即可打开cpu虚拟化
1egrep -o 'vmx | svm' /proc/cpuinfo | wc -l
关闭防火墙和selinux
123456# systemctl stop firewalld# systemctl disable firewalld# setenforce 0# vim /etc/selinux/config# 修改以下内容SELINUX=disabled
安装KVM1# yum install -y kvm virt-* libvirt bridge-utils qemu-img
查看kvm是否被加载到内核
1# lsmod | grep kvm
网络设置和VMware一样有桥接模式和nat模式
桥接模式就是添加了新网卡br0,将br0绑定到ens33上
12345678910111213141516171819202122绑定网卡--以太网通道--聚合链路--桥接网络[root@local ...
Apache源码安装
安装依赖软件1yum -y install apr apr-devel apr-util apr-util-devel cyrus-sasl-devel expat-devel libdb-devel openldap-devel pcre-devel pcre
解压软件包12tar zxf httpd-2.4.25 -C /usr/srccd /usr/src/httpd-2.4.25
代码编译12345./configure --prefix=/usr/local/httpd \ --enable-so \--enable-rewrite \--enable-charset-lite \--enable-cgi && make && make install
–prefix=/usr/local/httpd:安装到哪个目录–enable-so: 动态加载模块支持–enable-rewrite:地址重写–enable-charset-lite:字符集 ...
Centos系统磁盘扩容
需求:当前系统中的/home目录存储空间为50G,由于需要在home目录中存储东西,需要将home目录扩展到不小于1T
新加1T硬盘,并对硬盘创建分区
12345678910111213141516171819[root@localhost mapper]# fdisk /dev/sdbWelcome to fdisk (util-linux 2.32.1).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.The size of this disk is 2 TiB (2199023255552 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT). ...
LVM
lvm基本概念
物理存储设备(Physical Media):指系统的存储设备文件,比如 /dev/sda、/dev/sdb 等。PV(物理卷 Physical Volume):指硬盘分区或者从逻辑上看起来和硬盘分区类似的设备(比如 RAID 设备)。VG(卷组 Volume Group):类似于非 LVM 系统中的物理硬盘,一个 LVM 卷组由一个或者多个 PV(物理卷)组成。LV(逻辑卷 Logical Volume):类似于非 LVM 系统上的磁盘分区,LV 建立在 VG 上,可以在 LV 上建立文件系统。
lvm优缺点
LVM 的优点如下:文件系统可以跨多个磁盘,因此大小不再受物理磁盘的限制。可以在系统运行状态下动态地扩展文件系统大小。可以以镜像的方式冗余重要数据到多个物理磁盘上。可以很方便地导出整个卷组,并导入到另外一台机器上。LVM 也有一些缺点:在从卷组中移除一个磁盘的时候必须使用 reducevg 命令(这个命令要求root权限,并且不允许在快照卷组中使用)。当卷组中的一个磁盘损坏时,整个卷组都会受影响。因为增加了一个逻辑层,存储的性能会受影响。
安装lvm工具1y ...
DNS
服务器信息
IP
域名
角色
172.16.1.12
server1.dns.com
主DNS
172.16.1.13
server2.dns.com
备DNS
172.16.1.14
Client
当前dns服务器采用主备方式部署
主DNS配置安装bind软件1[root@Server1-DNS ~]# yum -y install bind
修改配置文件123456789101112[root@Server1-DNS ~]# vi /etc/named.confoptions { listen-on port 53 { 172.16.1.12; }; listen-on-v6 port 53 { ::1; }; directory "/var/named"; dump-file "/var/named/data/cac ...
FTP
匿名访问服务端安装FTP服务1[root@bogon ~]# yum -y install vsftpd
修改配置文件1234567891011[root@bogon ~]# vi /etc/vsftpd/vsftpd.confanonymous_enable=YES # 允许匿名访问write_enable=YES # 允许写文件anon_upload_enable=YES # 允许匿名用户上传文件anon_mkdir_write_enable=YES # 允许匿名用户创建目录和写权限手动添加:anon_other_write_enable=YES # 允许匿名用户删除、重命名等其它权限pasv_enable=YES # 设置被动模式pasv_min_port=4500 # 最小端口pasv_max_port=5000 # 最大端口# 会在4500-5000之间随机挑选端口来与服务端建立连接
客户端模式都是以被动模式与服务端建立连接,如果服务端设置主动模式,就需要在客户端 ...
