在linux上搭建简单的web网站

1,搭建一个静态网站

[root@localhost ~]# echo "welcome to openla.com" > /www/index.html
在linux上搭建简单的web网站_第1张图片

2,给该网站下建立三个子网站

先建立三个三个子目录 

[root@localhost ~]# mkdir /www/openla/stdent
[root@localhost ~]# mkdir /www/openla/data
[root@localhost ~]# mkdir /www/openla/money

[root@localhost ~]# echo "stdent " > /www/openla/stdent/index.html
[root@localhost ~]# echo "money  " > /www/openla/money/index.html
[root@localhost ~]# echo "data  " > /www/openla/data/index.html
在linux上搭建简单的web网站_第2张图片
 

 添加两个新用户

[root@localhost ~]# htpasswd -c /etc/httpd/user tian
New password: 
Re-type new password: 
Adding password for user tian
[root@localhost ~]# htpasswd  /etc/httpd/user song
New password: 
Re-type new password: 
Adding password for user song
更改主文件配置

在linux上搭建简单的web网站_第3张图片

使用https加密

使用私钥进行加密

[root@localhost private]# openssl genrsa -AES128 2048 > money.key
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
新建证书

[root@localhost certs]# openssl req -utf8 -new -key  /etc/pki/tls/private/money.key 
Enter pass phrase for /etc/pki/tls/private/money.key:
Could not read private key from /etc/pki/tls/private/money.key
80DB8502B17F0000:error:1608010C:STORE routines:ossl_store_handle_load_result:unsupported:crypto/store/store_result.c:151:
80DB8502B17F0000:error:1C800064:Provider routines:ossl_cipher_unpadblock:bad decrypt:providers/implementations/ciphers/ciphercommon_block.c:124:
80DB8502B17F0000:error:11800074:PKCS12 routines:PKCS12_pbe_crypt_ex:pkcs12 cipherfinal error:crypto/pkcs12/p12_decr.c:86:maybe wrong password
[root@localhost certs]# openssl req -utf8 -new -key  /etc/pki/tls/private/money.key 
Enter pass phrase for /etc/pki/tls/private/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) [XX]:86
State or Province Name (full name) []:shanxi
Locality Name (eg, city) [Default City]:xi'an
Organization Name (eg, company) [Default Company Ltd]:localhost
Organizational Unit Name (eg, section) []:money  
Common Name (eg, your name or your server's hostname) []:[email protected]
Email Address []:[email protected]

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
 

你可能感兴趣的:(linux,服务器)