配置使用ssl完成https访问apache服务器
- 安装mod_sll
[root@rhce yum.repos.d]# yum install -y mod_ssl
- 设置访问目录
[root@rhce myssl]# cd /var/www/myssl/
[root@rhce myssl]# echo "this is myssl" > index.html
- 配置
[root@rhce yum.repos.d]# cd /etc/httpd/conf.d/
[root@rhce conf.d]# vim myssl.conf
<Directory "/www/myssl">
AllowOverride None
Require all granted
</Directory>
<VirtualHost 192.168.80.140:443>
SSLEngine on
SSLProtocol all -SSLv3
SSLCipherSuite PROFILE=SYSTEM
SSLCertificateFile /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
DocumentRoot "/www/myssl"
</VirtualHost>
[root@rhce myssl]# setenforce 0
nfs挂载
- 开放/nfs/shared目录,供所有用户查询资料
服务端:
[root@server ~]# vim /etc/exports
/nfs/shared *(ro)
[root@server ~]# mkdir -p /nfs/shared
[root@server ~]# cd /nfs/shared/
[root@server shared]# echo "123" > share.txt
[root@server shared]# systemctl restart rpcbind
[root@server shared]# systemctl restart nfs-server
[root@server shared]# showmount -e 192.168.5.128
Export list for 192.168.80.128:
/nfs/shared *
客户端:
[root@client ~]# showmount -e 192.168.31.128
Export list for 192.168.80.128:
/nfs/shared *
[root@client ~]# mount 192.168.80.128:/nfs/shared /mnt
[root@client ~]# cd /mnt/
[root@client mnt]# ll
total 4
-rw-r--r--. 1 root root 4 Aug 3 16:45 share.txt
- 开放/nfs/upload目录,该目录为192.168.xxx.0/24网段的主机的数据上传目录,并将所有该网段主机上传文件的所属者和所属组映射为nfs-upload,其UID和GID为2001;
服务端:
[root@server shared]# mkdir /nfs/upload
[root@server shared]# useradd -u 2001 nfs-upload
[root@server shared]# vim /etc/exports
/nfs/shared *(ro)
/nfs/upload 192.168.80.0/24(rw,all_squash,anonuid=2001,anongid=2001)
[root@server nfs]# chmod o+w /nfs/upload/
[root@server nfs]# ll -d upload/
drwxr-xrwx 2 root root 6 Aug 3 16:57 upload/
[root@server shared]# systemctl restart rpcbind
[root@server shared]# systemctl restart nfs-server
客户端:
[root@client ~]# mount 192.168.80.128:/nfs/upload /upload
[root@client upload]# touch test.txt
[root@client upload]# ll
total 0
-rw-r--r--. 1 2001 2001 0 Aug 3 17:20 test.txt
服务端:
[root@server nfs]# ll upload/
total 0
-rw-r--r-- 1 nfs-upload nfs-upload 0 Aug 3 17:55 test.txt
- 将/home/tom(该目录为uid=1111,gid=1111的tom用户的家目录)目录仅共享给192.168.xxx.128这台主机上的jerry用户,jerry对该目录具有访问、新建和删除文件的权限
服务端;
[root@server nfs]# useradd -u 1111 tom
[root@server nfs]# vim /etc/exports
/nfs/shared *(ro)
/nfs/upload 192.168.80.0/24(rw,all_squash,anonuid=2001,anongid=2001)
/home/tom 192.168.80.129/255.255.255.0(rw,all_squash,anonuid=1111,anongid=1111)
[root@server nfs]# systemctl restart rpcbind
[root@server nfs]# systemctl restart nfs-server
客户端:
[root@client ~]# useradd -u 1111 jerry
[root@client ~]# mkdir /tom
[root@client ~]# showmount -e 192.168.80.128
Export list for 192.168.80.128:
/nfs/shared *
/home/tom 192.168.80.129/255.255.255.0
/nfs/upload 192.168.80.0/24
[root@client ~]# mount 192.168.80.128:/home/tom /tom
[root@client ~]# cd /tom
[root@client tom]# touch test.txt
[root@client tom]# ll
total 0
-rw-r--r--. 1 jerry jerry 0 Aug 3 16:06 test.txt
[root@client tom]# rm -f test.txt
[root@client tom]# ll
total 0
autofs自动挂载
远程nfs服务器要的目录为/nfs/autofs
客户端的的挂载目录/data/autofs
且设置自动卸载时间为60秒
服务端:
[root@server nfs]# vim /etc/exports
/nfs/shared *(ro)
/nfs/upload 192.168.80.0/24(rw,all_squash,anonuid=2001,anongid=2001)
/home/tom 192.168.80.129/255.255.255.0(rw,all_squash,anonuid=1111,anongid=1111)
/nfs/autofs *(ro)
[root@server nfs]# mkdir /nfs/autofs
[root@server nfs]# echo "123" > /nfs/autofs/test.txt
[root@server nfs]# systemctl restart rpcbind
[root@server nfs]# systemctl restart nfs-server
客户端:
[root@client tom]# vim /etc/auto.master
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
/data /etc/auto.mynfs --timeout 60
/misc /etc/auto.misc
[root@client tom]# vim /etc/auto.mynfs
autofs 192.168.80.128:/nfs/autofs
[root@client tom]# mkdir -p /data/autofs
[root@client tom]# systemctl restart autofs
[root@client tom]# mount | grep /data
/etc/auto.mynfs on /data type autofs (rw,relatime,fd=6,pgrp=3474,timeout=60,minproto=5,maxproto=5,indirect,pipe_ino=53804)
[root@client ~]# cd /data/autofs
[root@client autofs]# mount | grep /dat.128:/nfs/autofs on /data/autofs type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.31.129,local_lock=none,addr=192.168.31.128)