国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

云計算Linux運維——基礎(chǔ)服務(wù)應(yīng)用——HTTPD服務(wù)(8)更新中......

這篇具有很好參考價值的文章主要介紹了云計算Linux運維——基礎(chǔ)服務(wù)應(yīng)用——HTTPD服務(wù)(8)更新中......。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

1http協(xié)議

一、http協(xié)議

  • 應(yīng)用層協(xié)議
  • 作用
    • 在客戶端、web服務(wù)器傳遞數(shù)據(jù)
  • Hyper Text Transfer Protocol 超文本傳輸協(xié)議
    • 客戶端訪問web服務(wù)時,傳遞代碼,由瀏覽器解析代碼進(jìn)行展示

二、web服務(wù)

1、類型

  • 靜態(tài)網(wǎng)站
    • 網(wǎng)頁上所有資源都是固定的
    • html語言,js, jquery
  • 動態(tài)網(wǎng)站
    • 一段程序代碼,根據(jù)傳遞的參數(shù)不同展示不同的結(jié)果
      • PHP語言? ? ? ? ?*.php文件
      • Java語言? ? ? ? ?*.jsp文件

2、cookie、session

  • 作用
    • 識別客戶端登錄身份

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

?linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

?三、HTTP協(xié)議特性

1、http/0.9

  • 只支持傳輸純文本數(shù)據(jù)

2、http/1.0

  • 引用MIME機制
    • 傳輸非文本數(shù)據(jù)(圖片、視頻、音頻、動畫)
  • 緩存機制,加速網(wǎng)站的訪問
    • 服務(wù)器緩存
    • 客戶端緩存

3、http/1.1

  • 長連接機制? ? keepalive
    • 允許在一條連接上發(fā)送多次請求
      • 限制長連接的超時時間
      • 限制每個長連接的最大請求數(shù) 5000
  • 管道機制、
    • 允許一次性發(fā)送多個請求,并行
  • 加強了緩存的管理
    • 緩存靜態(tài)數(shù)據(jù)
    • 緩存過期時間

4、http/2

  • 以并行的方式發(fā)送請求、響應(yīng)

四、HTTP狀態(tài)碼、請求方法

1、狀態(tài)碼

  • 200
    • 成功響應(yīng)
  • 301、302、304
    • 成功響應(yīng)
    • 重定向
  • 4xx
    • 錯誤響應(yīng)
      • 403? ? ? ? ? 權(quán)限拒絕
      • 404? ? ? ? ? ?文件找不到
  • 5xx?
    • 錯誤響應(yīng)
      • 服務(wù)端配置

2、請求方法

  • GET
    • 用于獲取內(nèi)容、數(shù)據(jù)
  • POST
    • 上傳數(shù)據(jù)
  • DELETE

2httpd安裝配置

一、httpd軟件介紹

  • Linux
    • httpd、nginx、tomcat
  • Windows server
    • IIS

httpd介紹:

  • 構(gòu)建web服務(wù)器
    • 處理靜態(tài)頁面
    • http://httpd.apache.org/

1、httpd軟件版本

  • 2.2
  • 2.4

2、httpd部署方式

  • RPM
  • 源碼編譯

3、httpd特性

  • 開源、跨平臺的
  • 模塊化軟件
  • 支持虛擬主機功能
  • 支持https虛擬主機
  • 支持緩存

二、安裝啟動httpd

1、安裝httpd

[root@8 ~]# yum install -y httpd

2、啟動httpd

[root@8 ~]# systemctl start httpd
[root@8 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
root@8 ~]# netstat -anlp | grep http
tcp6       0      0 :::80                   :::*                    LISTEN      8048/httpd          
unix  3      [ ]         STREAM     CONNECTED     27734    8048/httpd       
[root@8 ~]# ps -elf | grep http
4 S root       8048      1  0  80   0 - 57610 poll_s 20:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
5 S apache     8049   8048  0  80   0 - 57610 inet_c 20:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
5 S apache     8050   8048  0  80   0 - 57610 inet_c 20:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
5 S apache     8051   8048  0  80   0 - 57610 inet_c 20:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
5 S apache     8052   8048  0  80   0 - 57610 inet_c 20:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
5 S apache     8053   8048  0  80   0 - 57610 inet_c 20:14 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
0 S root       8075   7980  0  80   0 - 28206 pipe_w 20:16 pts/0    00:00:00 grep --color=auto http
  • 父進(jìn)程
    • 管理子進(jìn)程、記錄日志、讀取配置文件
  • 子進(jìn)程
    • 用于接收、處理客戶端請求

3、測試訪問httpd

http://192.168.50.8/

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

?4、刪除測試頁面

[root@8 ~]# rm -rf /etc/httpd/conf.d/welcome.conf 
[root@8 ~]# systemctl restart httpd

5、建立測試網(wǎng)頁

root@8 ~]# ls /var/www/html/
index.html  music.html
[root@8 ~]# vim /var/www/html/music.html 

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

?三、httpd相關(guān)文件目錄

1、主配置文件

/etc/httpd/conf/httpd.conf

2、子配置文件

/etc/httpd/conf.d/*.conf

3、模塊路徑、配置文件

/etc/httpd/modules

/etc/httpd/conf.modules.d/*.conf

4、存放PID文件

/etc/httpd/run?

5、日志目錄、

/var/log/httpd

access_log error_log

  • access_log:訪問日志
  • error_log:錯誤日志

6、默認(rèn)網(wǎng)頁數(shù)據(jù)目錄

/var/www/html

四、配置文件解析——httpd.conf

1、指定httpd的工作目錄

ServerRoot "/etc/httpd"

2、指定監(jiān)聽的端口

Listen 192.168.59.8:80

3、加載子配置文件

Include conf.modules.d/*.conf

4、指定啟動進(jìn)程的用戶身份

User www

Group www

5、指定管理員郵箱

ServerAdmin root@localhost

6、指定網(wǎng)站的主機名

ServerName test1.linux.com

7、指定網(wǎng)頁目錄

DocumentRoot "/var/www/html"

8、指定默認(rèn)的網(wǎng)頁名稱

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

9、錯誤日志文件、級別

ErrorLog "logs/error_log"
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel error

10、訪問日志名稱、記錄格式

CustomLog "logs/access_log" combined

web訪問量:

1、PV Page View 頁面訪問量

2、UV User View 用戶訪問量

11、定義訪問日志格式

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

變量說明:

  1. %h 客戶端地址
  2. %l web認(rèn)證用戶
  3. %u windows用戶
  4. %t 訪問時間
  5. %r 請求方法 文件名稱 HTTP協(xié)議版本
  6. %s 狀態(tài)碼
  7. %b 響應(yīng)數(shù)據(jù)的大小
  8. %{Referer}i 超鏈接地址
  9. %{User-Agent}i 瀏覽器類型

12、長連接配置

KeepAliveTimeout 5
MaxKeepAliveRequests 100

13、針對目錄授權(quán)

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

配置說明:

  • options
    1. 客戶端訪問對應(yīng)目錄下的文件時受什么影響
      1. Indexes
        1. 無index.html首頁時,列出所有文件
      2. FollowSymLinks
        1. 允許網(wǎng)頁目錄下的軟鏈接文件被正常訪問
  • require 客戶端訪問認(rèn)

14、客戶端訪問認(rèn)證

  • 基于客戶端地址進(jìn)行認(rèn)證
  • 基于用戶名、密碼進(jìn)行認(rèn)證

1) 基于客戶端地址進(jìn)行認(rèn)證

Require all granted			//允許所有客戶端訪問
Require ip 10.1.1.1			//僅允許10.1.1.1訪問
<RequireAll>
    Require all granted
    Require not ip 10.252.46.165
</RequireAll>
Require all denied

2) 基于用戶名、密碼認(rèn)證

  • a) 創(chuàng)建認(rèn)證用戶
[root@localhost ~]# htpasswd -c /etc/httpd/.webuser martin
New password: 
Re-type new password: 
Adding password for user martin
[root@localhost ~]# 
[root@localhost ~]# cat /etc/httpd/.webuser 
martin:$apr1$6KV5I5w.$6iQ5ip.1bF3la2pHq9lX4/

b) 編輯httpd.conf

[root@localhost ~]# vim /etc/httpd/conf/httpd.conf 

<Directory "/var/www/html">
    ........................
    AuthType Basic
    AuthName "Need to login: "
    AuthUserFile "/etc/httpd/.webuser"
    Require valid-user
</Directory>

c) 重啟服務(wù)

[root@localhost ~]# systemctl restart httpd


3虛擬主機

虛擬主機 Virtual Host

一、虛擬主機介紹

1、作用

  • 在一臺服務(wù)器可以部署多套網(wǎng)站
  • 注意:
    • 虛擬主機配置后,主配置文件中部署的網(wǎng)站會失效!!!!!

2、類型

  • 基于名稱的虛擬主機 【常用】
    • 不同的網(wǎng)站指定不同的ServerName、DocumentRoot
  • 基于IP地址的虛擬主機
    • 不同的網(wǎng)站監(jiān)聽在不同的IP地址上
  • 基于端口的虛擬主機

3、配置虛擬主機

<VirtualHost IP:port>
    DocumentRoot xxxxx
    ServerName xxxxx
    ErrorLog xxxxxxxxxxxx
    CustomLog xxxxxxxxxxxxxxxx
</VirtualHost>

二、基于名稱的虛擬主機

網(wǎng)站名稱: vedio.linux.com 網(wǎng)頁目錄: /var/www/html/vedio

網(wǎng)站名稱: mp3.linux.com 網(wǎng)頁目錄: /mp3

1、配置vedio網(wǎng)站

1) 創(chuàng)建網(wǎng)頁目錄、測試首頁

[root@localhost ~]# mkdir /var/www/html/vedio
[root@localhost ~]# vim /var/www/html/vedio/index.html
<h1> vedio </h1>

2) 編輯虛擬主機配置文件

[root@localhost ~]# cat /etc/httpd/conf.d/vedio.conf
<VirtualHost 192.168.140.10:80>
    ServerName vedio.linux.com
    DocumentRoot /var/www/html/vedio
    ErrorLog /var/log/httpd/vedio_error.log
    CustomLog /var/log/httpd/vedio_access.log combined
</VirtualHost>
[root@localhost ~]# httpd -t 
Syntax OK
[root@localhost ~]# systemctl restart httpd

3) 測試訪問

2、配置mp3網(wǎng)站

1) 創(chuàng)建網(wǎng)頁目錄、測試首頁

[root@localhost ~]# mkdir /mp3
[root@localhost ~]# vim /mp3/index.html
<h1> mp3 </h1>

2) 編輯配置文件

[root@localhost ~]# cat /etc/httpd/conf.d/mp3.conf 
<VirtualHost 192.168.140.10:80>
     ServerName mp3.linux.com
     DocumentRoot /mp3
     ErrorLog /var/log/httpd/mp3_error.log
     CustomLog /var/log/httpd/mp3_access.log combined
</VirtualHost>

<Directory "/mp3">
    Require all granted
</Directory>
[root@localhost ~]# httpd -t
Syntax OK
[root@localhost ~]# systemctl restart httpd

3) 測試訪問

三、基于IP地址的虛擬主機

網(wǎng)站: python.linux.com 網(wǎng)頁目錄: /python 192.168.140.100

網(wǎng)站: shell.linux.com 網(wǎng)頁目錄: /shell 192.168.140.200

1、主機添加網(wǎng)卡、配置多個地址

[root@localhost network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:8f:c3:68 brd ff:ff:ff:ff:ff:ff
    inet 192.168.140.10/24 brd 192.168.140.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe8f:c368/64 scope link 
       valid_lft forever preferred_lft forever
3: ens37: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:8f:c3:72 brd ff:ff:ff:ff:ff:ff
    inet 192.168.140.100/24 brd 192.168.140.255 scope global noprefixroute ens37
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe8f:c372/64 scope link 
       valid_lft forever preferred_lft forever
4: ens38: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:8f:c3:7c brd ff:ff:ff:ff:ff:ff
    inet 192.168.140.200/24 brd 192.168.140.255 scope global noprefixroute ens38
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe8f:c37c/64 scope link tentative 
       valid_lft forever preferred_lft forever

2、配置python網(wǎng)站

[root@localhost ~]# cat /etc/httpd/conf.d/python.conf
<VirtualHost 192.168.140.100:80>
    ServerName python.linux.com
    DocumentRoot /python
    ErrorLog /var/log/httpd/python_error.log
    CustomLog /var/log/httpd/python_access.log combined
</VirtualHost>

<Directory "/python">
   Require all granted
</Directory>

3、配置shell網(wǎng)站

[root@localhost ~]# cat /etc/httpd/conf.d/shell.conf 
<VirtualHost 192.168.140.200:80>
    ServerName shell.linux.com
    DocumentRoot /shell
    ErrorLog /var/log/httpd/shell_error.log
    CustomLog /var/log/httpd/shell_access.log combined
</VirtualHost>

<Directory "/shell">
   Require all granted
</Directory>

4基于https協(xié)議部署虛擬主機

一、網(wǎng)站傳輸協(xié)議

  • http
    • 80/tcp
    • 數(shù)據(jù)以明文的方式傳輸
  • https
    • 443/tcp
    • 數(shù)據(jù)以密文的方式傳輸

二、安全性保障

  • 數(shù)據(jù)安全性
    • 加密、解密
  • 數(shù)據(jù)完整性
    • 校驗算法 MD5/SHA hash哈希算法
  • 身份的真實性保障

三、數(shù)據(jù)安全性的保障

通過加密算法確保數(shù)據(jù)的安全

發(fā)送方發(fā)送數(shù)據(jù)前加密數(shù)據(jù)、接收方解密數(shù)據(jù)

1、對稱加密算法

加密數(shù)據(jù)時使用的密鑰、解密的密鑰是一樣的

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

典型對稱加密算法

  • DES
  • 3DES
  • AES

加密數(shù)據(jù)

#  openssl enc -e -des -in /tmp/file01 -out /tmp/file01_s 
enter des-cbc encryption password:
Verifying - enter des-cbc encryption password:

解密數(shù)據(jù)

#  openssl enc -d -des -in /opt/file01_s -out /opt/file01 
enter des-cbc decryption password:

2、非對稱加密算法

加密、解密數(shù)據(jù)時用的密鑰是不一樣的

密鑰對 【公鑰、私鑰】

數(shù)據(jù)加密:

公鑰加密、私鑰解密

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

典型非對稱加密算法:

  • RSA
  • DSA

實際使用:

使用對稱算法加密真實的數(shù)據(jù), 使用非對稱加密算法加密對稱算法的密鑰

四、數(shù)據(jù)完整性保障

1、校驗算法

  • MD5
  • SHA

發(fā)送數(shù)據(jù)時,使用校驗算法對數(shù)據(jù)進(jìn)行校驗,生成校驗碼,同時將數(shù)據(jù)+校驗碼發(fā)送出去

接收方接收數(shù)據(jù),使用相同的校驗算法再次進(jìn)行校驗,對比校驗碼

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

五、身份的真實性

1、密鑰對

  • 數(shù)據(jù)加密
    • 公鑰加密、私鑰解密
  • 驗證簽名
    • 私鑰簽名、公鑰驗證簽名

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

流程:

1、電商服務(wù)器生成證書申請【.csr文件】, 同時將電商服務(wù)器的公鑰放入證書申請;將證書申請發(fā)送給CA

2、CA審批信息, 通過后CA會使用自己的私鑰進(jìn)行簽名;相當(dāng)于簽署證書【.crt】

3、客戶端訪問電商服務(wù)器時,服務(wù)器會將證書信息發(fā)送給客戶端

4、客戶端通過CA的公鑰驗證證書,驗證通過后可獲取電商服務(wù)器的公鑰

5、客戶端選取對稱算法、密鑰,使用公鑰加密,發(fā)送給服務(wù)器、服務(wù)器解密

6、進(jìn)行真實數(shù)據(jù)交互

六、配置基于https協(xié)議的虛擬主機

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

1、配置私有CA

  • 生成密鑰對
  • 生成自簽證書

1) 創(chuàng)建CA服務(wù)器需要的數(shù)據(jù)庫文件

[root@ca ~]# touch /etc/pki/CA/index.txt
[root@ca ~]# echo 01 > /etc/pki/CA/serial

2) 創(chuàng)建CA服務(wù)器需要的密鑰

[root@ca ~]# openssl genrsa -out /etc/pki/CA/private/cakey.pem 1024
Generating RSA private key, 1024 bit long modulus
..++++++
.....++++++
e is 65537 (0x10001)

3) 頒發(fā)自簽證書

[root@ca ~]# openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -out /etc/pki/CA/cacert.pem -days 3650
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]:china
string is too long, it needs to be less than  2 bytes long
Country Name (2 letter code) [XX]:cn
State or Province Name (full name) []:bj
Locality Name (eg, city) [Default City]:bj
Organization Name (eg, company) [Default Company Ltd]:bj
Organizational Unit Name (eg, section) []:bj
Common Name (eg, your name or your server's hostname) []:ca.linux.com
Email Address []:bj@qq.com
[root@ca ~]# 
[root@ca ~]# 
[root@ca ~]# ls /etc/pki/CA/
cacert.pem  certs  crl  index.txt  newcerts  private  serial

2、在web server上申請證書

1) 在web server創(chuàng)建密鑰對

 [root@web_server ~]# mkdir /etc/httpd/ssl
[root@web_server ~]# openssl genrsa -out /etc/httpd/ssl/www.linux.com.key 2048
Generating RSA private key, 2048 bit long modulus
......................+++
.....................................................................+++
e is 65537 (0x10001)
[root@web_server ~]#

2) 創(chuàng)建證書申請

[root@localhost ~]# openssl req -new -key /etc/httpd/ssl/www.linux.com.key -out /etc/httpd/ssl/www.linux.com.csr 

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]:cn
State or Province Name (full name) []:bj
Locality Name (eg, city) [Default City]:bj
Organization Name (eg, company) [Default Company Ltd]:bj
Organizational Unit Name (eg, section) []:bj
Common Name (eg, your name or your server's hostname) []:www.linux.com
Email Address []:bj@qq.com

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

3) 將證書申請發(fā)送給CA

[root@web_server ~]# rsync -av /usr/local/nginx/ssl/www.linux.com.csr root@192.168.140.11:/tmp/

4) CA簽署證書

[root@ca ~]# openssl ca -in /tmp/www.linux.com.csr -out /etc/pki/tls/certs/www.linux.com.crt -days 3650 
Using configuration from /etc/pki/tls/openssl.cnf
Check that the request matches the signature
Signature ok
Certificate Details:
        Serial Number: 1 (0x1)
        Validity
            Not Before: Jun 21 06:06:54 2021 GMT
            Not After : Jun 19 06:06:54 2031 GMT
        Subject:
            countryName               = cn
            stateOrProvinceName       = bj
            organizationName          = bj
            organizationalUnitName    = bj
            commonName                = www.linux.com
            emailAddress              = bj@qq.com
        X509v3 extensions:
            X509v3 Basic Constraints: 
                CA:FALSE
            Netscape Comment: 
                OpenSSL Generated Certificate
            X509v3 Subject Key Identifier: 
                67:6D:B8:84:3A:5C:BE:99:81:4A:49:F4:CD:61:5E:8B:99:3B:EF:13
            X509v3 Authority Key Identifier: 
                keyid:C8:EF:D2:FB:E8:D5:2B:50:D8:7C:07:7A:27:72:B5:D6:33:09:D6:56

Certificate is to be certified until Jun 19 06:06:54 2031 GMT (3650 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
[root@ca ~]# ls /etc/pki/tls/certs/
ca-bundle.crt  ca-bundle.trust.crt  make-dummy-cert  Makefile  renew-dummy-cert  www.linux.com.crt
[root@ca ~]# 
[root@ca ~]# cat /etc/pki/CA/serial
02
[root@ca ~]# cat /etc/pki/CA/index.txt
V	310619060654Z		01	unknown	/C=cn/ST=bj/O=bj/OU=bj/CN=www.linux.com/emailAddress=bj@qq.com

5) 將證書發(fā)送給web server

[root@ca ~]# rsync -av /etc/pki/tls/certs/www.linux.com.crt root@192.168.140.10:/etc/httpd/ssl

3、安裝mod_ssl模塊

[root@localhost ~]# yum install -y mod_ssl 

4、創(chuàng)建網(wǎng)頁目錄、測試文件

[root@localhost ~]# mkdir /linux
[root@localhost ~]# vim /linux/index.html
<h1> www.linux.com </h1>

5、配置ssl虛擬主機

[root@localhost ~]# vim /etc/httpd/conf.d/ssl.conf 
....................
<VirtualHost _default_:443>

# General setup for the virtual host, inherited from global configuration
DocumentRoot "/linux"
ServerName www.linux.com:443
SSLCertificateFile /etc/httpd/ssl/www.linux.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/www.linux.com.key

<Directory "/linux">
    Require all granted
</Directory>
[root@localhost ~]# httpd -t
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Syntax OK
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# netstat -antp | grep http
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      7144/httpd          
tcp6       0      0 :::443                  :::*                    LISTEN      7144/httpd          

6、測試訪問

Linux.com - News For Open Source Professionals

linux httpd,云計算Linux運維,云計算,運維,linux,服務(wù)器,網(wǎng)絡(luò)

七、配置https自動跳轉(zhuǎn)文章來源地址http://www.zghlxwxcb.cn/news/detail-845977.html

     RewriteEngine On
     RewriteCond %{HTTP_HOST} www.linux.com [NC]
     RewriteRule ^/   https://www.linux.com [L]
  • %{HTTP_HOST}
    • 調(diào)用客戶端所訪問的網(wǎng)站主機名
  • [NC]
    • 忽略大小寫
  • [L]
    • 立即響應(yīng)

到了這里,關(guān)于云計算Linux運維——基礎(chǔ)服務(wù)應(yīng)用——HTTPD服務(wù)(8)更新中......的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • 云計算第1階段_Linxu基礎(chǔ)知識_day03,字節(jié)跳動8年老Linux運維面試官經(jīng)驗談

    云計算第1階段_Linxu基礎(chǔ)知識_day03,字節(jié)跳動8年老Linux運維面試官經(jīng)驗談

    5 遠(yuǎn)程連接sshd服務(wù) ps:sshd默認(rèn)端口號:22 5.1 手動修改默認(rèn)端口號 6 文件拷貝、移動、刪除 6.1 拷貝文件或目錄 6.2 移動文件或目錄 **ps:**判斷上一條命令是否執(zhí)行成功 命令:echo $? 如果返回值為0,證明我們上一條命令執(zhí)行是成功的, 如果返回值非0,證明我們上一條命令執(zhí)行

    2024年04月12日
    瀏覽(52)
  • linux 15day apache apache服務(wù)安裝 httpd服務(wù)器 安裝虛擬主機系統(tǒng) 一個主機 多個域名如何綁定

    linux 15day apache apache服務(wù)安裝 httpd服務(wù)器 安裝虛擬主機系統(tǒng) 一個主機 多個域名如何綁定

    1.apache目錄介紹 1.準(zhǔn)備測試頁面 2.訪問控制測試 可以直接編輯apache主配置文件 修改默認(rèn)網(wǎng)站發(fā)布目錄 配置域名解析: 測試訪問 基于端口 訪問:www.soso666.com 訪問: test.soso666.com:81 可以配置域名解析,也可以不用配域名解析

    2024年02月04日
    瀏覽(28)
  • 【Linux】Linux運維基礎(chǔ)

    【Linux】Linux運維基礎(chǔ)

    Linux簡介 : Linux是一個開源的操作系統(tǒng)內(nèi)核,最初由Linus Torvalds創(chuàng)建。它通常與GNU工具一起使用,以創(chuàng)建一個完整的操作系統(tǒng)。 Linux操作系統(tǒng)有許多基于內(nèi)核的發(fā)行版,如Ubuntu、CentOS、Debian等,每個發(fā)行版都有其獨特的特性和包管理工具。 登錄和用戶管理 : 使用SSH(Secure

    2024年02月04日
    瀏覽(101)
  • 云計算Linux運維——Linux系統(tǒng)管理——磁盤管理

    云計算Linux運維——Linux系統(tǒng)管理——磁盤管理

    點關(guān)注不迷路 目錄 1磁盤分區(qū)管理 一、硬盤基礎(chǔ)知識 1、硬盤的表示方法 2、查看塊設(shè)備 3、硬盤分區(qū)的表示方法 4、創(chuàng)建文件系統(tǒng)/格式化 5、操作磁盤的流程 二、管理磁盤分區(qū)工具 fdisk 1、使用格式 2、查看磁盤分區(qū) 三、磁盤分區(qū)案例 1、規(guī)劃 2、創(chuàng)建分區(qū) 3、讓內(nèi)核識別硬盤

    2024年02月12日
    瀏覽(54)
  • 云計算Linux運維——Linux系統(tǒng)管理——軟件管理

    目錄 點關(guān)注不迷路 1RPM軟件管理 1、軟件安裝包類型 2、RPM軟件安裝包的組成 二、RPM軟件管理操作 rpm命令 1、安裝軟件 2、查看軟件 3、卸載軟件 2yum工具介紹 一、yum工具介紹 1、優(yōu)勢 2、yum源配置文件 二、配置本地源安裝軟件 1、備份自帶的HTTP源 2、編寫本地源 3、清除舊的

    2024年02月06日
    瀏覽(49)
  • 云計算Linux運維——Linux系統(tǒng)管理——網(wǎng)絡(luò)參數(shù)配置

    云計算Linux運維——Linux系統(tǒng)管理——網(wǎng)絡(luò)參數(shù)配置

    點關(guān)注不迷路 目錄 1網(wǎng)絡(luò)參數(shù)配置 一、網(wǎng)絡(luò)參數(shù) 1、主機名 2、查看網(wǎng)卡IP地址 3、查看網(wǎng)關(guān) 4、查看DNS服務(wù)器地址 二、配置網(wǎng)卡 1、修改網(wǎng)卡配置文件 2、nmcli命令 3、nmcli配置網(wǎng)卡 3)重新加載配置 三、VMware網(wǎng)絡(luò)工作模式 1、虛擬網(wǎng)絡(luò)、虛擬網(wǎng)卡 2、虛擬網(wǎng)絡(luò)工作模式 2雙網(wǎng)卡綁

    2024年02月04日
    瀏覽(27)
  • Linux運維之shell基礎(chǔ)

    Linux運維之shell基礎(chǔ)

    基本語法: 注意事項: ①[ 條件判斷式 ],中括號和條件判斷式之間必須有空格 ②if 后要有空格 例如,現(xiàn)在寫一個if.sh腳本文件 基本語法: 注意事項: (1)case 行尾必須為單詞“in”,每一個模式匹配必須以右括號“)”結(jié)束。 (2)雙分號“;;”表示命令序列結(jié)束,相當(dāng)于

    2024年02月02日
    瀏覽(32)
  • 運維 | 查看 Linux 服務(wù)器 IP 地址

    大多數(shù)在操作 Linux 系統(tǒng)時,我們經(jīng)常需要知道服務(wù)器的 IP 比便于后續(xù)的一系列操作,這時候有快速查看主機 IP 的命令行操作,能夠有效的幫助我們 本章節(jié)主要記錄一些常用查看服務(wù)器 IP 的命令,希望對大家有所幫助。 查看 Linux 服務(wù)器的 IP 地址的命令大體上有以下幾種。

    2024年04月27日
    瀏覽(103)
  • [云計算學(xué)習(xí)3] Linux基礎(chǔ) : 使用chrony搭建時間服務(wù)器并讓下游NTP同步時間

    [云計算學(xué)習(xí)3] Linux基礎(chǔ) : 使用chrony搭建時間服務(wù)器并讓下游NTP同步時間

    操作平臺 : centos 7 (虛擬機) 配置: 2H4G 情景 : 主機1(服務(wù)器)搭建時間服務(wù)器并讓主機2(客戶端)進(jìn)行NTP同步 在終端輸入以下命令安裝chrony 然后設(shè)置服務(wù)開機自啟動 完成上述操作后,我們就可以進(jìn)行下一步了 ? : 此操作請在 主機1 (服務(wù)器) 操作 我們關(guān)閉SELinux 輸入 vim /etc/selinu

    2024年02月15日
    瀏覽(26)
  • 【運維】Linux 跨服務(wù)器復(fù)制文件文件夾

    如果是云服務(wù) 建議用內(nèi)網(wǎng)ip scp是secure copy的簡寫,用于在Linux下進(jìn)行遠(yuǎn)程拷貝文件的命令,和它類似的命令有cp,不過cp只是在本機進(jìn)行拷貝不能跨服務(wù)器,而且scp傳輸是加密的??赡軙晕⒂绊懸幌滤俣?。當(dāng)你服務(wù)器硬盤變?yōu)橹蛔x read only system時,用scp可以幫你把文件移出來

    2024年02月08日
    瀏覽(109)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包