标签:没有 ssl acl log es2017 host 端口 4.6 virtual
12、实现一个web服务器
[root@server0 ~]# yum install httpd -y
[root@server0 ~]# rpm -ql httpd
[root@server0 ~]# cp /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf /etc/httpd/conf.d/vhosts.conf.bak
[root@server0 ~]# wget -O /var/www/html/index.html http://classroom.example.com/materials/station.html [root@server0 ~]# vim /etc/httpd/conf.d/vhost-server0.conf <Directory "/var/www/html"> <RequireAll> Require all granted Require not host .my133t.com </RequireAll> </Directory> <VirtualHost *:80> DocumentRoot "/var/www/html" ServerName server0.example.com </VirtualHost> [root@server0 ~]# systemctl restart httpd [root@server0 ~]# systemctl enable httpd [root@server0 conf.d]# firewall-cmd --permanent --add-service=http [root@server0 conf.d]# firewall-cmd --permanent --add-rich-rule=‘rule family=ipv4 source address=172.17.10.0/24 service name=http reject‘ [root@server0 conf.d]# firewall-cmd --permanent --add-rich-rule=‘rule family=ipv4 source address=172.25.0.0/24 service name=http accept‘ [root@server0 conf.d]# firewall-cmd --reload [root@server0 ~]# lab examrhce grade
13、配置安全web服务
[root@server0 ~]# yum install mod_ssl -y [root@server0 ~]# firewall-cmd --permanent --add-service=https [root@server0 ~]# firewall-cmd --reload
[root@server0 ~]# wget -O /etc/pki/tls/certs/server0.crt http://classroom.example.com/pub/tls/certs/server0.crt [root@server0 ~]# wget -O /etc/pki/tls/private/server0.key http://classroom.example.com/pub/tls/private/server0.key [root@server0 ~]# wget -O /etc/pki/tls/certs/example-ca.crt http://classroom.example.com/pub/example-ca.crt [root@server0 ~]# rpm -ql mod_ssl [root@server0 ~]# cd /etc/httpd/conf.d/ [root@server0 conf.d]# cp ssl.conf ssl.conf.bak [root@server0 conf.d]# vim ssl.conf <Directory "/var/www/html"> <RequireAll> Require all granted Require not host .my133t.org </RequireAll> </Directory> SSLCertificateFile /etc/pki/tls/certs/server0.crt SSLCertificateKeyFile /etc/pki/tls/private/server0.key SSLCACertificateFile /etc/pki/tls/certs/example-ca.crt.
[root@server0 conf.d]# systemctl restart httpd.service
[root@server0 conf.d]# systemctl enable httpd.service
14、配置虚拟主机
[root@server0 ~]# mkdir /var/www/virtual [root@server0 ~]# cd /var/www/virtual [root@server0 virtual]# wget http://classroom.example.com/materials/www.html [root@server0 virtual]# mv www.html index.html [root@server0 ~]# id floyd [root@server0 ~]# useradd floyd [root@server0 ~]# setfacl -m u:floyd:rwx /var/www/virtual [root@server0 ~]# getfacl /var/www/virtual [root@server0 ~]# vim /etc/httpd/conf.d/vhost-www0.conf <Directory "/var/www/virtual"> <RequireAll> Require all granted Require not host .my133t.com </RequireAll> </Directory> <VirtualHost *:80> DocumentRoot "/var/www/virtual" ServerName www0.example.com </VirtualHost> [root@server0 ~]# systemctl restart httpd
15、配置web内容的访问
[root@server0 ~]# mkdir -pv /var/www/virtual/private [root@server0 ~]# cd /var/www/virtual/private [root@server0 private]# wget http://classroom.example.com/materials/private.html [root@server0 private]# mv private.html index.html [root@server0 ~]# vim /etc/httpd/conf.d/vhost-www0.conf ###追加以下内容 <Directory "/var/www/virtual/private"> Require all denied Require local </Directory> [root@server0 ~]# systemctl restart httpd
16、实现动态Web内容 [新版题库已经没有这题]
[root@server0 ~]# yum install mod_wsgi -y [root@server0 ~]# mkdir -pv /var/www/webapp root@server0 ~]# cd /var/www/webapp [root@server0 ~]# wget http://classroom.example.com/materials/webinfo.wsgi [root@server0 webapp]# getenforce [root@server0 webapp]# semanage port -a -t http_port_t -p tcp 8908 [root@server0 webapp]# semanage port -l | grep 89 图形界面配置端口 [root@server0 ~]# yum install policycoreutils-gui.x86_64 -y [root@server0 ~]# system-config-selinux [root@server0 ~]# vim /etc/httpd/conf.d/vhost-webapp0.conf Listen 8908 <Directory "/var/www/webapp"> Require all granted </Directory> <VirtualHost *:8908> DocumentRoot "/var/www/webapp" ServerName webapp0.example.com WSGIScriptAlias / /var/www/webapp/webinfo.wsgi </VirtualHost> [root@server0 ~]# firewall-cmd --permanent --add-rich-rule=‘rule family=ipv4 source address=172.25.0.0/24 port port=8908 protoco[root@server0 ~]# firewall-cmd --reload l=tcp accept [root@server0 ~]# systemctl restart httpd
标签:没有 ssl acl log es2017 host 端口 4.6 virtual
原文地址:http://www.cnblogs.com/venicid/p/7620487.html