当前位置: 首页 > news >正文

RHCSA作业3

网站需求:

1.基于域名www.openlab.com可以访问网站内容为 welcome to openlab!!!

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# yum install nginx -y[root@localhost ~]# vim /etc/nginx/nginx.confserver{listen 80;root /www/openlab;server_name www.openlab.com;location / {}
}[root@localhost ~]# mkdir /www/openlab/ -p
[root@localhost ~]# echo welcome to openlab!!! > /www/openlab/index.html

配置域名解析

[root@localhost ~]# cat /etc/hosts
# Loopback entries; do not change.
# For historical reasons, localhost precedes localhost.localdomain:
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# See hosts(5) for proper format and other examples:
# 192.168.1.10 foo.mydomain.org foo
# 192.168.1.13 bar.mydomain.org bar
192.168.188.129  www.openlab.com //写入当前主机IP和域名配置[root@localhost ~]# curl www.openlab.com //检验实验结果
welcome to openlab!!!

2.给该公司创建三个子界面分别显示学生信息,教学资料和缴费网站,基于www.openlab.com/student 网站访问学生信息,www.openlab.com/data网站访问教学资料,www.openlab.com/money网站访问缴费网站。

#更改配置文件[root@localhost ~]# vim /etc/nginx/nginx.conf
server {listen       80;listen       [::]:80;server_name  www.openlab.com;root         /www/openlab;location /data {alias /www/openlab/data;index index.html;} location /money {alias /www/openlab/money;index index.html;}location /student {alias /www/openlab/student;index index.html;auth_basic "please input password";auth_basic_user_file /www/openlab/student/passwd;}# Load configuration files for the default server block.include /etc/nginx/default.d/*.conf;error_page 404 /404.html;location = /404.html {}error_page 500 502 503 504 /50x.html;location = /50x.html {}}#创建三个目录并在对应的index.html中写入[root@localhost ~]# mkdir /www/openlab/student
[root@localhost ~]# mkdir /www/openlab/data
[root@localhost ~]# mkdir /www/openlab/money
[root@localhost ~]# echo "this is student" > /www/openlab/student/index.html
[root@localhost ~]# echo "this is data" > /www/openlab/data/index.html
[root@localhost ~]# echo "this is money" > /www/openlab/money/index.html

3.要求

(1)访问该网站http请求都通过https响应。
(2)学生信息网站只有song和tian两人可以访问,其他用户不能访问。
#创建可访问的用户和密码文件[root@localhost ~]# htpasswd -c /www/openlab/student/passwd song
New password: 
Re-type new password: 
Adding password for user song
[root@localhost ~]# htpasswd  /www/openlab/student/passwd tian
New password: 
Re-type new password: 
Adding password for user tian

#修改配置文件[root@localhost ~]# vim /etc/nginx/nginx.conf
server {listen        443 ssl http2;  #改listen       [::]:443 ssl http2;#改server_name  www.openlab.com;root         /www/openlab;location /data {alias /www/openlab/data;index index.html;}location /money {alias /www/openlab/money;index index.html;}location /student {alias /www/openlab/student;index index.html;auth_basic "please input password";auth_basic_user_file /www/openlab/student/passwd;}ssl_certificate "/www/openlab/openlab.crt";     #添加以下内容ssl_certificate_key "/www/openlab/openlab.key";ssl_session_cache shared:SSL:1m;ssl_session_timeout  10m;ssl_ciphers PROFILE=SYSTEM;ssl_prefer_server_ciphers on;[root@localhost ~]#  openssl  genrsa 2048 > /www/openlab/openlab.key
[root@localhost ~]#  openssl  req -utf8 -new -key /www/openlab/openlab.key  -x509  -days [root@localhost ~]# systemctl restart nginx

http://www.dtcms.com/a/590400.html

相关文章:

  • 网站建设用免费素材如何做好网站推
  • Git高效开发:常用命令速查指南
  • 还有哪些网站做产品众筹应届毕业生简历模板
  • 南京做企业网站公司哪家好如何在手机上制作网站
  • 视图、存储过程与函数
  • JavaSE语法巩固——图书管理系统
  • Java 抽象类与接口深度解析:从概念到实战应用
  • 软件测试——自动化测试常用函数(超详细)
  • 韶关企业网站建设好看的seo网站
  • 网站网页区别是什么产品展示类网站源码
  • 网站规划的步骤微信开发公众平台
  • 怎么自己做直播网站吗制作公司网站一般多久能好
  • 公司合法网站域名怎么注册水冷眸WordPress
  • 网站开发应财务如何记账wordpress 字符替换插件
  • 网站建设运营成本什么是网络营销评估主要评估哪些方面
  • 升级 macOS 26.1 之后 MagicMouse2 疯狂卡顿飘移,已解决
  • 无锡高端网站建设舆情信息网站
  • 网站建设的成功之处有哪些怎么做一个自己公司的网页
  • 怎么建设自己产品网站加强红色网站建设
  • 【QT开发】天气预报项目(详细注释版)
  • Vue嵌套(多级)路由
  • 精品网站建设公司互联网产品推广是做什么的
  • 东莞360推广的网站是谁做的云南楚雄医药高等专科学校
  • 学做网站的视频建设银行电商网站
  • 目前网站类型主要包括哪几种江苏营销型网站建设公司
  • 临沂网站开发多少钱wordpress无法发送
  • 信用网站标准化建设模块都有哪些东道设计招聘要求
  • YOLO项目笔记
  • 网站制作合同模板汽车网站flash模板
  • 凡科网做网站能达到什么效果济南网站建设(力推聚搜网络)