Linux(LAMP)

打印 上一主题 下一主题

主题 1027|帖子 1027|积分 3081

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
赛题拓扑:

标题:


  • 安装WEB服务。
  • 服务以用户webuser系统用户运行。
  • 限制WEB服务只能使用系统500M物理内存。
  • 全站点启用TLS访问,使用本机上的“CSK Global Root CA”颁发机构颁发,网站证书信息如下:
    C = CN
    ST = China
    L = BeiJing
    O = skills
    OU = Operations Departments
    CN = *.chinaskills.com
  • 客户端访问https时应无欣赏器(含终端)安全警告信息。
  • 当用户使用http访问时主动跳转到https安全连接。
  • 搭建www.chinaskills.cn站点。
  • 网页文件放在StorgeSrv服务器上。
  • 在StorageSrv上安装MriaDB,在本机上安装PHP,发布WordPress网站。
  • MariaDB数据库管理员信息:User: root/ Password: 000000。
  1. [root@appsrv ~]# yum install httpd mod_ssl php php-mysql -y
  2. [root@appsrv ~]# useradd webuser
  3. [root@appsrv ~]# vim /etc/passwd
  4.   webuser:x:666:1001::/home/webuser:/bin/bash    #uid改为1000以下
  5. [root@appsrv ~]# vim /etc/httpd/conf/httpd.conf  #修改66、67行
  6.   User webuser
  7.   Group webuser
  8. [root@appsrv ~]# systemctl enable httpd
  9. Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
  10. [root@appsrv ~]# vim /etc/systemd/system/multi-user.target.wants/httpd.service
  11. [server]
  12. memorylimit=500M
  13. [root@appsrv ~]# systemctl daemon-reload
  14. [root@appsrv ~]# systemctl restart httpd
  15. [root@appsrv ~]# mkdir /webdata
  16. [root@appsrv ~]# vim /etc/fstab
  17. 192.168.100.200:/webdata /webdata nfs defaults 0 0
  18. [root@appsrv ~]# mount -a
  19. [root@appsrv ~]# df -Th | grep /webdata
  20. 192.168.100.200:/webdata nfs4       20G  185M   19G    1% /webdata
  21. 先配置好CA证书颁发机构
  22. [root@appsrv csk-rootca]# openssl genrsa -out httpd.key 2048
  23. [root@appsrv csk-rootca]# openssl req -new -key httpd.key -out httpd.csr
  24. You are about to be asked to enter information that will be incorporated
  25. into your certificate request.
  26. What you are about to enter is what is called a Distinguished Name or a DN.
  27. There are quite a few fields but you can leave some blank
  28. For some fields there will be a default value,
  29. If you enter '.', the field will be left blank.
  30. -----
  31. Country Name (2letter code)[XX]:CN
  32. State or Province Name (full name)[]:China
  33. Locality Name (eg, city)[Default City]:BeiJing                           
  34. Organization Name (eg, company)[Default Company Ltd]:skills
  35. Organizational Unit Name (eg, section)[]:Operations Departments
  36. Common Name (eg, your name or your server's hostname) []:*.chinaskills.cn
  37. Email Address []:
  38. Please enter the following 'extra' attributes
  39. to be sent with your certificate request
  40. A challenge password []:
  41. An optional company name []:
  42. [root@appsrv csk-rootca]# openssl x509 -req -in http.csr  -CA /csk-rootca/csk-ca.pem -CAkey /csk-rootca/private/cakey.pem -CAcreateserial -out http.crt
  43. Signature ok
  44. subject=/C=CN/ST=China/L=BeiJing/O=skills/OU=Operations Departments/CN=*.chinaskills.cn
  45. Getting CA Private Key
  46. [root@appsrv csk-rootca]# scp http.* root@192.168.100.200:/root
  47. The authenticity of host '192.168.100.200 (192.168.100.200)' can't be established.
  48. ECDSA key fingerprint is SHA256:pWgL9ec8DMjRGJO79thzFylRMNnAsLGLY8TUc+RO8Ms.
  49. ECDSA key fingerprint is MD5:44:5c:51:9a:2c:1b:ff:7c:0c:13:09:d3:77:a9:8e:cd.
  50. Are you sure you want to continue connecting (yes/no)? yes
  51. Warning: Permanently added '192.168.100.200' (ECDSA) to the list of known hosts.
  52. root@192.168.100.200's password:
  53. http.crt                                        100% 1261     1.6MB/s   00:00   
  54. http.csr                                        100% 1033     2.2MB/s   00:00   
  55. http.key                                        100% 1675     2.9MB/s   00:00   
  56. [root@appsrv csk-rootca]# scp http.* root@192.168.100.254:/root
  57. The authenticity of host '192.168.100.254 (192.168.100.254)' can't be established.
  58. ECDSA key fingerprint is SHA256:fbInU3tFkaQUhhZNSIsHGZOPMG1T1f3J55qqtzfdeAU.
  59. ECDSA key fingerprint is MD5:a4:fa:8d:39:a3:9c:c0:81:1b:f0:6b:5b:f1:31:9e:aa.
  60. Are you sure you want to continue connecting (yes/no)? yes
  61. Warning: Permanently added '192.168.100.254' (ECDSA) to the list of known hosts.
  62. root@192.168.100.254's password:
  63. http.crt                                         100% 1261     2.2MB/s   00:00   
  64. http.csr                                         100% 1033     2.6MB/s   00:00   
  65. http.key                                         100% 1675     3.4MB/s   00:00   
  66. [root@appsrv csk-rootca]# cd
  67. [root@appsrv ~]# vim /etc/httpd/conf.d/web.conf
  68. <VirtualHost *:80>
  69. redirect permanent / https://www.chinaskills.cn/
  70. </VirtualHost>
  71. <virtualHost www.chinaskills.cn:443>
  72. Documentroot "/webdata/wordpress"            网站根目录
  73. servername www.chinaskills.cn                网站的域名
  74. sslengine on                                 开启SSL
  75. sslcertificatefile /csk-rootca/httpd.crt     网站证书的路径
  76. sslcertificatekeyfile /csk-rootca/httpd.key  网站密钥的路径
  77. <Directory /webdata >                        配置根目录的权限
  78. require all granted
  79. </Directory>
  80. </VirtualHost>
  81. 上传wordpress安装包
  82. [root@appsrv ~]# unzip wordpress-4.9.4-zh_CN.zip
  83. [root@appsrv ~]# ls /webdata/
  84. wordpress  wordpress-4.9.4-zh_CN.zip
  85. 部署数据库:
  86. [root@storagesrv ~]# systemctl start mariadb
  87. [root@storagesrv ~]# mysql_secure_installation
  88. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
  89.       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
  90. In order to log into MariaDB to secure it, we'll need the current
  91. password for the root user.  If you've just installed MariaDB, and
  92. you haven't set the root password yet, the password will be blank,
  93. so you should just press enter here.
  94. Enter current password for root (enter for none):
  95. OK, successfully used password, moving on...
  96. Setting the root password ensures that nobody can log into the MariaDB
  97. root user without the proper authorisation.
  98. Set root password? [Y/n] y                           
  99. New password: 000000
  100. Re-enter new password: 000000
  101. Password updated successfully!
  102. Reloading privilege tables..
  103. ... Success!
  104. By default, a MariaDB installation has an anonymous user, allowing anyone
  105. to log into MariaDB without having to have a user account created for
  106. them.  This is intended only for testing, and to make the installation
  107. go a bit smoother.  You should remove them before moving into a
  108. production environment.
  109. Remove anonymous users? [Y/n]
  110. ... Success!
  111. Normally, root should only be allowed to connect from 'localhost'.  This
  112. ensures that someone cannot guess at the root password from the network.
  113. Disallow root login remotely? [Y/n]
  114. ... Success!
  115. By default, MariaDB comes with a database named 'test' that anyone can
  116. access.  This is also intended only for testing, and should be removed
  117. before moving into a production environment.
  118. Remove test database and access to it? [Y/n]
  119. - Dropping test database...
  120. ... Success!
  121. - Removing privileges on test database...
  122. ... Success!
  123. Reloading the privilege tables will ensure that all changes made so far
  124. will take effect immediately.
  125. Reload privilege tables now? [Y/n]
  126. ... Success!
  127. Cleaning up...
  128. All done!  If you've completed all of the above steps, your MariaDB
  129. installation should now be secure.
  130. Thanks for using MariaDB!
  131. [root@storagesrv ~]# mysql -u root -p
  132. Enter password:
  133. Welcome to the MariaDB monitor.  Commands end with ; or \g.
  134. Your MariaDB connection id is 14
  135. Server version: 5.5.68-MariaDB MariaDB Server
  136. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  137. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  138. MariaDB [(none)]> create database wordpress;
  139. Query OK, 1 row affected (0.00 sec)
  140. MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by
  141. '000000'with grant option;
  142. Query OK, 0 rows affected (0.00 sec)
  143. MariaDB [(none)]> flush privileges;
  144. Query OK, 0 rows affected (0.00 sec)
  145. MariaDB [(none)]>
  146. [root@storagesrv ~]#
  147. [root@appsrv ~]# systemctl restart httpd
  148. [root@insidecli ~]# cp csk-ca.pem /etc/pki/ca-trust/source/anchors/csk-ca.crt
  149. [root@insidecli ~]# update-ca-trust
  150. [root@insidecli ~]# curl -I http://www.chinaskills.cn
  151. [root@insidecli ~]# curl -I http://www.chinaskills.cn
  152. insidecli浏览器访问https://www.chinaskills.cn发布网站
复制代码
 

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

愛在花開的季節

论坛元老
这个人很懒什么都没写!
快速回复 返回顶部 返回列表