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

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

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值