iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 14
0
Security

不專業infra甘苦談系列 第 14

Day-14 台中又沒放假了,延續上次Django架站

前言

如題,台中市長我恨你,我要放颱風假阿~~~~ 我就不說我還有VCP還沒讀完阿~~~~~~~

環境

  1. Apache: htppd(Apache/2.4.6 (CentOS))
  2. firewalld: version 0.5.3

htppd(Apache)

  1. 下載指令
sudo yum install httpd
sudo yum install httpd-devel
  1. 常見操作指令
sudo systemctl start httpd    #開啟Apache
sudo systemctl restart httpd    #重啟Apache
sudo systemctl enable httpd    #預設開機後重啟Apache
sudo systemctl status httpd    #查看Apache狀態
sudo systemctl stop httpd    #關閉Apache
  1. 於瀏覽器中輸入其主機IP應可看到此畫面

  2. 若無看到此畫面,請查詢Centos7 firewall(防火牆)設定

應該是被防火牆預設擋住,需增加條件開啟HTTP存取權

防火牆firewalld

  1. Centos內建firewalld
  2. 預設為開啟firewalld服務,查看狀態
systemctl status firewalld
  1. 限制http只能由IP(140.134.25.0/24)連入
sudo firewall-cmd --add-rich-rule="rule family="ipv4" source address="140.134.25.0/24" service name="http" accept" --permanent
  1. 重啟服務
sudo firewall-cmd --reload
  1. 列出防火牆條件
sudo firewall-cmd --list-all
  • 想學更多的可以看網路上這位大大的介紹

上一篇
Day-13 聽說北北基放假,來個Django環境教學吧~
下一篇
Day-15 Django 以WSGI串接Apache
系列文
不專業infra甘苦談30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言