1.基于域名[www.openlab.com](http://www.openlab.com)可以访问网站内容为 welcome to openlab!!!
#下载nginx
yum install nginx -y
#关闭防火墙
systemctl stop firewalld
setenforce 0
#重启nginx
systemctl restart nginx
#修改配置文件
vim /etc/nginx/conf.d/test_name.conf
server {
listen 192.168.36.128:80;
root /www/name/node1;
server_name www.openlab.com;
location / {
}
}
#创建网页目录
mkdir -pv /www/name/node1
#写入网页内容
vim /www/name/node1/index.html
welcome to openlab!!!
#在C:\Windows\System32\drivers\etc\hosts中写入域名
192.168.36.128 www.openlab.com
#重启网络服务
systemctl restart nginx
2.给该公司创建三个子界面分别显示学生信息,教学资料和缴费网站,基于[www.openlab.com/student](http://www.openlab.com/student) 网站访问学生信息,[www.openlab.com/data](http://www.openlab.com/data)网站访问教学资料,网站访问缴费网站(http://www.openlab.com/money网站访问缴费网站)。
#创建目录并写入内容
mkdir /www/openlab/student -pv
mkdir /www/openlab/data -pv
mkdir /www/openlab/momey -pv
echo this is student > /www/openlab/student/index.html
echo this is data > /www/openlab/data/index.html
echo this is money > /www/openlab/money/index.html
#创建用户
htpasswd -c /etc/nginx/user song
htpasswd -c /etc/nginx/user tian
3.要求
(1)学生信息网站只有song和tian两人可以访问,其他用户不能访问。
(2)访问缴费网站实现数据加密基于https访问。
#下载mod_ssl
yum install mod_ssl -y
cd /etc/pki/tls/private/
openssl genrsa -aes128 2048 > money.key
#在/etc/pki/tls/certs目录新建证书
cd /etc/pki/tls/certs/
openssl req -utf8 -new -key /etc/pki/tls/private/money.key -x509 -days 365 -out money.crt
Enter pass phrase for /etc/pki/tls/private/money.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:86
State or Province Name (full name) []:shanxi
Locality Name (eg, city) [Default City]:xi'an
Organization Name (eg, company) [Default Company Ltd]:openlab
Organizational Unit Name (eg, section) []:RHCE
Common Name (eg, your name or your server's hostname) []:localhost
Email Address []:money@qq.com
架设一台NFS服务器,并按照以下要求配置
1、开放/nfs/shared目录,供所有用户查询资料
2、开放/nfs/upload目录,为192.168.xxx.0/24网段主机可以上传目录,
并将所有用户及所属的组映射为nfs-upload,其UID和GID均为210
3、将/home/tom目录仅共享给192.168.xxx.xxx这台主机,并只有用户tom可以完全访问该目录
<VirtualHost 192.168.225.128:81>
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/money.crt
SSLCertificateKeyFile /etc/pki/tls/private/money.key
ServerName www.openlab.com
DocumentRoot /www/openlab/money
</VirtualHost>
<Directory /www/openlab/money>
AllowOverride none
Require all granted
</Directory>
#重启nginx
systemctl restart nginx
#关闭防火墙
systemctl stop firewalld.service