Nginx 搭建Web服务

题目:

1.web服务器的主机ip:192.168.78.128

2.web服务器的默认访问目录为/var/www/html

默认发布内容为default‘s page

3.站点news.timinglee.org默认发布目录

为/var/www/virtual/timinglee.org/news

默认发布内容为 news.timinglee.org

4.站点login.timinglee.org在被访问时必须强制走加密协议,其默认

发布目录为/var/www/virtual/timinglee.org/login

默认发布内容为login.timinglee.org

 1、安装Nginx

[root@ceph01 ~]# yum install nginx -y

2、修改配置文件的默认访问路径

[root@ceph01 nginx]# vim /etc/nginx/nginx.conf

3、创建目录,并写入内容

 [root@ceph01 nginx]# mkdir -p /var/www/html     # -p(逐级创建目录)

 [root@ceph01 nginx]# echo "default‘s page" > /var/www/html/index.html

 4、添加站点news.timinglee.org

[root@ceph01 nginx]# vim /etc/hosts

在原先(/etc/nginx/nginx.conf)http模块里面在添加一个server

[root@ceph01 nginx]# vim /etc/nginx/nginx.conf

 创建目录,并写入内容

[root@ceph01 nginx]# mkdir -p /var/www/virtual/timinglee.org/news

 5、语法检测,并重启nginx服务

[root@ceph01 nginx]# nginx -t

[root@ceph01 nginx]# systemctl restart nginx.service

 6、生成密钥

[root@ceph01 ~]# openssl genrsa -des3 -out server.zq 2048   (密码1234)

 7、生成证书

[root@ceph01 ~]# openssl req -new -key server.zq -out server.crt

Enter pass phrase for server.zq:

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) [AU]:CN

State or Province Name (full name) [Some-State]:SN

Locality Name (eg, city) []:XI'AN

Organization Name (eg, company) [Internet Widgits Pty Ltd]:YOOZOO     

Organizational Unit Name (eg, section) []:SRE

Common Name (e.g. server FQDN or YOUR name) []:SERVER

Email Address []:2687336532@qq.com 

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:1234

An optional company name []:zq

 最后,和上面操作一样!!!

 

 

相关推荐

  1. 在 【Linux Centos】下Nginx Web服务器

    2024-04-26 11:12:03       25 阅读
  2. 如何一个nginxweb服务器

    2024-04-26 11:12:03       21 阅读
  3. Linux上web服务器(Apache、Nginx

    2024-04-26 11:12:03       2 阅读
  4. Nginx服务案例

    2024-04-26 11:12:03       15 阅读

最近更新

  1. linux:命令执行过程【图表】

    2024-04-26 11:12:03       0 阅读
  2. 系统架构设计师——网络设计

    2024-04-26 11:12:03       0 阅读
  3. SSL证书到期自动巡检脚本-推送钉钉告警

    2024-04-26 11:12:03       1 阅读
  4. 如何才能在Linux下编写驱动程序

    2024-04-26 11:12:03       1 阅读
  5. Tomcat打破双亲委派模型的方式

    2024-04-26 11:12:03       1 阅读
  6. C++惯用法: 通过std::decltype来SFINAE掉表达式

    2024-04-26 11:12:03       1 阅读
  7. HTTP 范围Range请求

    2024-04-26 11:12:03       1 阅读

热门阅读

  1. LeetCode 每日一题 ---- 【1146.快照数组】

    2024-04-26 11:12:03       16 阅读
  2. Apache Spark 的基本概念和在大数据分析中的应用

    2024-04-26 11:12:03       16 阅读
  3. 点云配准类相关文献阅读记录

    2024-04-26 11:12:03       15 阅读
  4. ChatGPT API - 笔记

    2024-04-26 11:12:03       17 阅读
  5. leetcode543--二叉树的直径

    2024-04-26 11:12:03       14 阅读
  6. 【数据结构】LRU缓存

    2024-04-26 11:12:03       14 阅读
  7. 【动态规划】Leetcode 139. 单词拆分【中等】

    2024-04-26 11:12:03       14 阅读