botang 发表于 2020-4-1 20:16:09

课程第28次:2020-04-01星期三

1. DDL : CREATE TABLE
1.1
MariaDB > create table product ( idint(11)primary key auto_increment ,
    ->                                    name varchar(100)not null,
    ->                                    price doublenot null,
    ->                                    stock int(11),
    ->                                    id_category int(11),
    ->                                    id_manufacturer int(11) ) ;
Query OK, 0 rows affected (0.018 sec)

MariaDB > MariaDB > alter table productadd constraint check ( id_categoryis not null ) ;
Query OK, 1 row affected (0.043 sec)               
Records: 1Duplicates: 0Warnings: 0
MariaDB > alter table product modify stock int(11) not null;
Query OK, 0 rows affected (0.246 sec)
Records: 0Duplicates: 0Warnings: 0



2. DML (CRUD)
2.1
MariaDB > insert into product (name, price, stock, id_category, id_manufacturer) values
    ->                     ('SDSSDP-128G-G25 2.5', 82.04 , 30 , 3,1);
Query OK, 1 row affected (0.003 sec)MariaDB > update productset price=92.04, stock=31 where id=1;
Query OK, 1 row affected (0.004 sec)
Rows matched: 1Changed: 1Warnings: 0MariaDB > insert into product (name, price, stock, id_category, id_manufacturer) values                     ('CPU A', 1000.04 , 30 , 3,10);
Query OK, 1 row affected (0.003 sec)

MariaDB > select* from product;
+----+---------------------+---------+-------+-------------+-----------------+
| id | name                | price   | stock | id_category | id_manufacturer |
+----+---------------------+---------+-------+-------------+-----------------+
|1 | SDSSDP-128G-G25 2.5 |   92.04 |    31 |         3 |               1 |
|2 | CPU A               | 1000.04 |    30 |         3 |            10 |
+----+---------------------+---------+-------+-------------+-----------------+
2 rows in set (0.001 sec)

MariaDB > delete from product where id=2;
Query OK, 1 row affected (0.004 sec)

MariaDB > select* from product;
+----+---------------------+-------+-------+-------------+-----------------+
| id | name                | price | stock | id_category | id_manufacturer |
+----+---------------------+-------+-------+-------------+-----------------+
|1 | SDSSDP-128G-G25 2.5 | 92.04 |    31 |         3 |               1 |
+----+---------------------+-------+-------+-------------+-----------------+
1 row in set (0.001 sec)

MariaDB > 3. DCL :GRANT:
MariaDB > grant selectoninventory.* to mobius@'%';
Query OK, 0 rows affected (0.001 sec)

4. Apache:
<VirtualHost *:80>
    ServerAdmin root@server4.example.com
    DocumentRoot "/var/www/html"
    <Directory "/var/www/html">
      Options Indexes FollowSymLinks
      AllowOverride None
      Require all granted
    </Directory>
    ServerName server4.example.com
    ErrorLog "/var/log/httpd/server4.example.com-error.log"
    CustomLog "/var/log/httpd/server4.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin root@www4.example.com
    DocumentRoot "/var/www/virtual"
    <Directory "/var/www/virtual">
      Options FollowSymLinks
      AllowOverride None
      Require all granted
    </Directory>
    ServerName www4.example.com
    ErrorLog "/var/log/httpd/www4.example.com-error.log"
    CustomLog "/var/log/httpd/www4.example.com-access.log" common
</VirtualHost>
SSL.conf的完整:
#
# When we also provide SSL we have to listen to the
# standard HTTPS port in addition.
#
Listen 443 https

##
##SSL Global Context
##
##All SSL configuration in this context applies both to
##the main server and all SSL-enabled virtual hosts.
##

#   Pass Phrase Dialog:
#   Configure the pass phrase gathering process.
#   The filtering dialog program (`builtin' is a internal
#   terminal dialog) has to provide the pass phrase on stdout.
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog

#   Inter-Process Session Cache:
#   Configure the SSL Session Cache: First the mechanism
#   to use and second the expiring timeout (in seconds).
SSLSessionCache         shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout300

#
# Use "SSLCryptoDevice" to enable any supported hardware
# accelerators. Use "openssl engine -v" to list supported
# engine names.NOTE: If you enable an accelerator and the
# server does not start, consult the error logs and ensure
# your accelerator is functioning properly.
#
SSLCryptoDevice builtin
#SSLCryptoDevice ubsec

##
## SSL Virtual Host Context
##

<VirtualHost _default_:443>
ServerAdmin root@server4.example.com
    WSGIScriptAlias / /var/www/html/special.wsgi
    ServerName server4.example.com
    ErrorLog "/var/log/httpd/https_server4.example.com-error.log"
    CustomLog "/var/log/httpd/https_server4.example.com-access.log" common
SSLEngine on
SSLProtocol all -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite PROFILE=SYSTEM
SSLProxyCipherSuite PROFILE=SYSTEM
SSLCertificateFile /etc/pki/tls/certs/server4.crt
SSLCertificateKeyFile /etc/pki/tls/private/server4.key
SSLCACertificateFile /etc/pki/tls/certs/example-ca.crt
</VirtualHost>

<VirtualHost _default_:443>
ServerAdmin root@www4.example.com
    DocumentRoot "/var/www/virtual"
    ScriptAlias/cgi-bin/ '/var/www/cgi-bin/'
    <Directory "/var/www/virtual">
      Options Indexes FollowSymLinks
      AllowOverride None
      Require all granted
    </Directory>

   <Directory "/var/www/virtual/money">
      Options Indexes FollowSymLinks
      AllowOverride None
      Require all denied
      Require local
    </Directory>
   
    ServerName www4.example.com
    ErrorLog "/var/log/httpd/https_www4.example.com-error.log"
    CustomLog "/var/log/httpd/https_www4.example.com-access.log" common
SSLEngine on
SSLProtocol all -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite PROFILE=SYSTEM
SSLProxyCipherSuite PROFILE=SYSTEM
SSLCertificateFile /etc/pki/tls/certs/server4.crt
SSLCertificateKeyFile /etc/pki/tls/private/server4.key
SSLCACertificateFile /etc/pki/tls/certs/example-ca.crt
</VirtualHost>










botang 发表于 2020-4-4 20:17:13

补充视频:
1. IPv6 LOCAL LINK不用设置就有:
# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu 1500
      inet 192.168.1.133netmask 255.255.255.0broadcast 192.168.1.255
      inet6 fe80::20c:29ff:fefc:1ec4prefixlen 64scopeid 0x20<link>
      ether 00:0c:29:fc:1e:c4txqueuelen 1000(Ethernet)
      RX packets 154bytes 23675 (23.1 KiB)
      RX errors 0dropped 0overruns 0frame 0
      TX packets 197bytes 20834 (20.3 KiB)
      TX errors 0dropped 0 overruns 0carrier 0collisions 0
inet6 fe80::20c:29ff:fefc:1ec4
ether 00:0c:29:fc:1e:c4
这个IPv6地址是MAC地址变来的:MAC48bit需要填充ff:fe形成64bit的IPv6主机部分,加上64bit:fe80::2,构成128bit的本地链IPv6地址。
2. IPv6没有192.168/172.16/10这些RFC1918, 而只有fd00::/8这个RFC4193


3. IPv6的 DHCP要用:ff00::/8 (ff02::1)

4. LOCAL LINK 地址在ssh时要写%, 而2000的地址不能
# ssh2003:ac18::305
The authenticity of host '2003:ac18::305 (<no hostip for proxy command>)' can't be established.
ECDSA key fingerprint is SHA256:mh2gX29DHW4YsRvJsbyBbbwWbMLKfltjuyzZE1HNHBk.
Are you sure you want to continue connecting (yes/no)? ^C
# ssh2003:ac18::305
The authenticity of host '2003:ac18::305 (<no hostip for proxy command>)' can't be established.
ECDSA key fingerprint is SHA256:mh2gX29DHW4YsRvJsbyBbbwWbMLKfltjuyzZE1HNHBk.
Are you sure you want to continue connecting (yes/no)? ^C
# ssh   fe80::d032:ed47:17aa:b962
ssh_exchange_identification: Connection closed by remote host

页: [1]
查看完整版本: 课程第28次:2020-04-01星期三