浅浅搭个web网站吧。。。。。

浅浅搭个web网站吧。。。。。_第1张图片

一.准备工作

1.[root@node ~]#systenctl status firewalld
  [root@node ~]#getenforce
2.C:\\windows\system32\drives\hosts
添加信息:192.168.32.133 www.openlab.com
3.vim /etc/hosts
  192.168.32.133 www.openlab.com
4.[root@node ~]# yum install nginx -y
  [root@node ~]# systemctl restart nginx
  [root@node ~]# yum install httpd-tools -y

二.创建文件夹和目录

浅浅搭个web网站吧。。。。。_第2张图片

浅浅搭个web网站吧。。。。。_第3张图片

三.student添加用户密码

[root@node ~]# htpasswd -c /etc/nginx/passwd song
New password: 
Re-type new password: 
Adding password for user song
[root@node ~]# htpasswd /etc/nginx/passwd tian
New password: 
Re-type new password: 
Adding password for user tian

四.money创建私钥和数字证书

[root@node ~]# openssl genrsa -aes128 2048 > /etc/nginx/money.key
Generating RSA private key, 2048 bit long modulus (2 primes)
.+++++
..................................................+++++
e is 65537 (0x010001)
Enter pass phrase:
Verifying - Enter pass phrase:
[root@node ~]# openssl req -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]:86
State or Province Name (full name) [Some-State]:shanxi
Locality Name (eg, city) []:xi'an   
Organization Name (eg, company) [Internet Widgits Pty Ltd]:openlab
Organizational Unit Name (eg, section) []:rhce
Common Name (e.g. server FQDN or YOUR name) []:mnwl
Email Address []:[email protected]
[root@node nginx]# cp money.key money.key.org
[root@node nginx]# openssl rsa -in money.key.org -out money.key


五. 更改nginx的配置文件,重启服务

浅浅搭个web网站吧。。。。。_第4张图片

[root@node nginx]# nginx -t
[root@node nginx]# systemctl restart nginx

六.测试结果

浅浅搭个web网站吧。。。。。_第5张图片

浅浅搭个web网站吧。。。。。_第6张图片

浅浅搭个web网站吧。。。。。_第7张图片

浅浅搭个web网站吧。。。。。_第8张图片

浅浅搭个web网站吧。。。。。_第9张图片

你可能感兴趣的:(RHCE,前端)