配置使用ssl完成https访问apache服务器,配置访问apache的cgi程序,nfs挂载,autofs自动挂载

本文介绍了如何配置Apache服务器以实现https访问,详细讲解了安装mod_ssl、设置访问目录的过程。此外,还阐述了nfs挂载的方法,包括开放共享目录的步骤,并展示了服务端和客户端的配置示例。最后,文章还涉及了autofs自动挂载的配置,以实现在特定时间内自动挂载和卸载远程nfs服务器的目录。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

配置使用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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值