修改http配置文件并授权访问
[root@150 ~]# dnf -y install httpd
[root@150 ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:111 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@150 ~]#systemctl stop firewalld
[root@150 ~]# cd /var/www/html/
将斗地主压缩包上传到/var/www/html/中
[root@150 html]# ls
斗地主.zip
[root@150 html]# unzip 斗地主.zip
[root@150 html]# ls
'HTML5 canvas移动端斗地主小游戏' 斗地主.zip
[root@150 html]# rm -rf 斗地主.zip
[root@150 html]# mv 'HTML5 canvas移动端斗地主小游戏'/ doudizhu
[root@150 html]# ls
doudizhu
[root@150 html]#
[root@150 html]# cd doudizhu/
[root@150 doudizhu]# ls
DJDDZ.js img index.html JControls.js Prototype.js ResourceData.js
[root@150 doudizhu]#
在网页中访问该游戏目录
访问成功后开始授权访问,在httpd配置文件中修改配置,只拒绝192.168.89.150访问,允许其他ip访问
[root@150 doudizhu]# cd
[root@150 ~]# cd /etc/httpd/
[root@150 httpd]# ls
conf conf.d conf.modules.d logs modules run state
[root@150 httpd]# cd conf
[root@150 conf]# ls
httpd.conf magic
[root@150 conf]# vim httpd.conf
98 ServerName www.example.com:80
162 <Directory "/var/www/html/doudizhu">
163 <RequireAll>
164 Require not ip 192.168.89.150
165 Require all granted
166 </RequireAll>
167 </Directory>
168
[root@150 conf]# httpd -t
Syntax OK
[root@150 conf]#
[root@150 conf]# systemctl restart httpd
在物理机中能够访问到
只允许192.168.89.150访问,其他全部拒绝
[root@150 conf]# vim httpd.conf
162 <Directory "/var/www/html/doudizhu">
163 <RequireAll>
164 Require ip 192.168.89.150
165 </RequireAll>
166