τα στοιχεία επικοινωνίας μου
Ταχυδρομείο[email protected]
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Πίνακας περιεχομένων
1. Δημιουργήστε έναν λογαριασμό χρήστη
3. Διαμορφώστε το αρχείο δευτερεύουσας διαμόρφωσης υπηρεσίας http
4. Δημιουργήστε έναν φάκελο για πρόσβαση στην υπηρεσία http και ανακατευθύνετε την είσοδο στο αρχείο
5. Διαμορφώστε την τοπική αποθήκη Linux και την τοπική αποθήκη στα Windows
Έλεγχος ταυτότητας χρήστη
- # 创建两个账户
- [root@localhost ~]# htpasswd -c /etc/httpd/zhanghao tom
- New password:
- Re-type new password:
- Adding password for user tom
- [root@localhost ~]# htpasswd /etc/httpd/zhanghao jerry
- New password:
- Re-type new password:
- Adding password for user jerry
- # 查看是否创建成功
- [root@localhost ~]# tail /etc/httpd/zhanghao
- tom:$apr1$2s/wloz6$G0SlGTKB62a4.2gJmy.AL.
- jerry:$apr1$lOxB9Dtq$tOTaJ35Jtt8dWouHbjgWi1
1. Κατεβάστε το mod_ssl
[root@localhost ~]# yum install mod_ssl -y
Σημείωση: Για να κάνετε λήψη του λογισμικού, πρέπει να ρυθμίσετε τις παραμέτρους της αποθήκης και να τοποθετήσετε, εάν είναι απαραίτητο, μπορείτε να ελέγξετε το άρθρο που έγραψα νωρίτερα.
2.tls κρυπτογράφηση:
- # 创建密钥
- [root@localhost certs]# openssl genrsa -aes128 2048 > jiami.key
- # 输入密码
- Enter PEM pass phrase:
- Verifying - Enter PEM pass phrase:
- # 创建证书
- [root@localhost certs]# openssl req -utf8 -new -key jiami.key -x509 -days 100 -out jiami.crt
- Enter pass phrase for jiami.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) []:shaanxi # 省份
- Locality Name (eg, city) [Default City]:xi'an # 城市
- Organization Name (eg, company) [Default Company Ltd]:rhce # 组织
- Organizational Unit Name (eg, section) []:peihua # 组织单元
- Common Name (eg, your name or your server's hostname) []:www.hehe.com # 主机名!!!
- Email Address []:[email protected] # 邮箱
3.Τοποθεσία κλειδιού κινητού
- # 移动密钥位置
- [root@localhost certs]# cd /etc/pki/tls/certs
- # 密钥位置为/etc/pki/tls/private/jiami.key
- [root@localhost certs]# mv jiami.key ../private/
4. Τροποποιήστε το αρχείο /etc/httpd/conf.d/ssl.conf
- SSLCertificateFile /etc/pki/tls/certs/jiami.crt
- SSLCertificateKeyFile /etc/pki/tls/private/jiami.key
Τροποποιήστε τα κλειδιά και τα πιστοποιητικά που δημιουργήσατε για τον εαυτό σας
- [root@localhost certs]# vim /etc/httpd/conf.d/vhost.conf
- # 重启服务时需要输入创建tls时的密码
- [root@localhost certs]# systemctl restart httpd
- 🔐 Enter TLS private key passphrase for www.hehe.com:443 (RSA) : ******
περιεχόμενο εγγράφου:
- <directory /www>
- allowoverride none
- require all granted
- </directory>
- # 用户认证
- <directory /usr/local/secret>
- authtype basic
- authname "Please input your passwd: "
- authuserfile /etc/httpd/zhanghao
- require user tom jerry
- </directory>
- # tls加密,地址为自己的主机地址,端口为443代表https服务
- <virtualhost 192.168.198.151:443>
- SSLEngine on
- SSLCertificateFile /etc/pki/tls/certs/jiami.crt
- SSLCertificateKeyFile /etc/pki/tls/private/jiami.key
- documentroot /www/hehe
- servername www.hehe.com
- alias /hehe /usr/local/secret
- </virtualhost>
Επανεκκινήστε την υπηρεσία http
systemctl restart httpd
- [root@localhost certs]# mkdir /www
- [root@localhost certs]# mkdir /www/hehe
- [root@localhost certs]# mkdir /usr/local/secret
- [root@localhost certs]# echo hehe > /www/hehe/index.html
- [root@localhost certs]# echo secret > /usr/local/secret/index.html
1. Τοπική αποθήκη Linux (/etc/hosts)
- [root@localhost certs]# vim /etc/hosts
- 192.168.198.151 www.hehe.com
2. Διαμορφώστε το τοπικό αποθετήριο στα Windows
Εάν χρειάζεται να κάνετε δοκιμή στο πρόγραμμα περιήγησης, πρέπει να διαμορφώσετε το τοπικό αποθετήριο των Windows (C:WindowsSystem32driversetchosts)
2.1 win+r για να ανοίξετε το τρέχον παράθυρο
2.2ctrl+shift+enter, εκτελείται ως διαχειριστής
2.3 Εισαγάγετε "σημειωματάριο" και το Σημειωματάριο θα εμφανιστεί.
2.4 Άνοιγμα αρχείου
2.5 Επιλέξτε /windows/system32/drivers/etc/host
2.6 Προσθέστε τον κώδικα στο αρχείο hosts
192.168.198.151 www.hehe.com
- [root@localhost certs]# systemctl stop firewalld
- [root@localhost certs]# setenforce 0
- # 修改过子配置文件,都需要重启http服务,生效
- [root@localhost certs]# systemctl restart httpd