RHCE练习

mkdir -p /www/timinglee    #创建timinglee文件夹

echo 'welcom to timinglee' > /www/openlab/index.html     #在网页中显示welcom to timinglee

vim /etc/nginx/nginx.conf    #进入nginx.conf修改数据

server {

        listen 80;

        server_name 192.168.159.120;   #修改成创建的网址

        root /www/timinglee;    #修改成创建的文件夹
systemctl start nginx   #重启服务
mkdir /www/timinglee/data     #创建文件夹data

echo 'data' > /www/timinglee/data/index.html   #在data网页中显示data

vim /etc/nginx/nginx.conf        #进入nginx.conf继续修改数据,接着之前的继续向下编写

server {

        listen 80;

        server_name 192.168.159.130;

        root /www/timinglee;

location /data {                             # 增加如下子配置

        alias /www/timinglee/data;

        index index.html index.htm;


systemctl start nginx   #重启服务
mkdir /www/timinglee/student    #创建文件夹student

 echo 'student' > /www/timinglee/student/index.html     #在student网页中显示student 

useradd song      #创建用户song和tianpasswd song
useradd tian
passwd tian

htpasswd -c /etc/nginx/passwd song # 密码123

htpasswd /etc/nginx/passwd tian

vim /etc/nginx.conf     #进入nginx.conf继续修改数据,接着之前的继续向下编写

 server {
        listen       80;
        server_name  192.168.159.130;
        root         /www/timinglee;
        location /data {
                        alias /www/timinglee/data;
                        index index.html index.htm;
        }
        location /student {                   # 增加如下子配置
                        alias /www/timinglee/student;
                        index index.html index.htm;
                        auth_basic "please input password";
                        auth_basic_user_file /etc/nginx/passwd;
        }
systemctl start nginx   #重启服务
mkdir /www/timinglle/money   #创建文件夹money

  echo 'money' > /www/timinglee/money/index.html     #在money网页中显示money

leessl genrsa -aes128 2048 > /etc/nginx/money.key        #在/etc/nginx目录下制作整数所用的私钥文件zy.key 

[root@server ~]# leesslreq -utf8 -new -key /etc/nginx/money.key -x509 -days 365 -out /etc/nginx/money.crt         # 制作证书
Enter pass phrase for /etc/nginx/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) [AU]:CN     
State or Province Name (full name) [Some-State]:Shanxi                    # 省份
Locality Name (eg, city) :xi'an             # 城市
Organization Name (eg, company) [Internet Widgits Pty Ltd]:mitang        # 公司
Organizational Unit Name (eg, section) :wangluo           # 部门
Common Name (e.g. server FQDN or YOUR name) :server         # 主机名
cd /etc/nginx       #切换目录 
 cp money.key   money.key.org          #拷贝私钥密码
leessl rsa -in money.key.org -out money.key        #重做
[root@server nginx]# leessl rsa -in money.key.org -out money.key
Enter pass phrase for money.key.org:                # 输 入私钥密码
writing RSA key

vim /etc/nginx/nginx.conf         #进入nginx.conf继续修改数据,接着之前的继续向下编写

server {
        listen       80;
        server_name  www.timinglee.com;
        root         /www/timinglee;
        location /data {
                        alias /www/timinglee/data;
                        index index.html index.htm;
                                }
        location /student {
                        alias /www/timinglee/student;
                        index index.html index.htm;
                        auth_basic "please input password";
                        auth_basic_user_file /etc/nginx/passwd
 systemctl restart nginx           #重启服务
 点击继续访问


  • 19
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值