1.安装所需软件并进到Windows的hosts文件DNS映射
用yum命令安装所需软件
yum install httpd-tools -y
进Windows的hosts文件
C:\windows\System32\drivers\etc\hosts 在最后一行添加本机IP地址和网站
2.创建www.openlab.com网站
mkdir -p /www/openlab
echo 'welcom to openlab' > /www/openlab/index.html
vim /etc/nginx/nginx.vonf //编辑配置文件
systemctl start nginx
打开浏览器进行网站测试:
3.创建教学资料子网站www.openlab.com/data
mkdir /www/openlab/data
echo 'data' > /www/openlab/data/index.html
vim /etc/nginx/nginx.conf
systemctl restart ngin
打开浏览器进行网站 www.openlab.com/data 测试:
4.创建学生信息子网站
mkdir /www/openlab/student
echo 'student' > /www/openlab/student/index.html
useradd song
passwd song
useradd tian
passwd tian
htpasswd -c /etc/nginx/passwd song
htpasswd /etc/nginx/passwd tian
vim /etc/nginx/nginx.conf
systemctl restart nginx
打开浏览器进行网站 www.openlab.com/student 测试 :
5.创建缴费子网站 www.openlab.com/money
mkdir /www/openlab/money
openssl genrsa -aes128 2048 > /etc/nginx/monkey 建立密钥
制作证书
openssl req -utf8 -new -key /etc/nginx/money.key -x509 -days 365 -out /etc/nginx/money.crt
cd /etc/nginx
cp money.key money.key.org
vim /etc/nginx/nginx.conf
systemctl restart nginx