[精讚] [會員登入]
2348

[Centos7] selinux 修改網頁連線的埠號

想把網頁改到非標準的80埠,在selinux上要如何修改?

分享此文連結 //n.sfs.tw/12931

分享連結 [Centos7] selinux 修改網頁連線的埠號@新精讚
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-10-24 20:08:36 最後編修
2018-11-29 15:06:36 By 張○○
 

自動目錄

 

想把網頁改到非標準的80埠,例如5353埠,在selinux上要如何修改?

一、前置作業

  首先在網頁的設定上監聽要改為監聽5353埠 --略。

  防火牆5353埠打開

# firewall-cmd --zone=public --add-port=5353/tcp --permanent

 

二、安裝semanage

  請參考 [Centos7] 安裝 semanage (selinux工具程式)

三、檢查目前網頁的

查看模組(例如apache)
# semanage module -l

Module Name               Priority  Language

abrt                      100       pp    
accountsd                 100       pp    
acct                      100       pp    
afs                       100       pp    
...

該模組的設定會放在 /etc/selinux/targeted/active/modules

但這是編過的檔案

查看埠號類型
# semanage port -l
SELinux Port Type              Proto    Port Number

afs3_callback_port_t           tcp      7001
afs3_callback_port_t           udp      7001
afs_bos_port_t                 udp      7007
afs_fs_port_t                  tcp      2040
afs_fs_port_t                  udp      7000, 7005
afs_ka_port_t                  udp      7004
afs_pt_port_t                  tcp      7002

...

和http有關的埠號
# semanage port -l | grep 'http'
http_cache_port_t              tcp      8080, 8118, 8123, 10001-10010
http_cache_port_t              udp      3130
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988
pegasus_https_port_t           tcp      5989

把5353埠加入http_port_t的type中

# semanage port -a -t http_port_t -p tcp 5353

這樣子就可以了

 

延伸閱讀

[MySQL/Mariadb] 修改預設的連線埠號3306

 

END

你可能感興趣的文章

[postfix] open /etc/postfix/main.cf: Permission denied 等錯誤 遇到開啟 /etc/postfix/main.cf: Permission denied 等錯誤解決

[Centos7] 安裝 semanage (selinux工具程式) 安裝selinux的工具程式 semanage

DNS壓力測試工具queryperf 要怎麼知道我安裝的DNS是否能耐受的住網路上的攻擊或大量查詢,這裡有一個免費的工具 queryperf

[CentOS6] 設定 sendmail Centos6上設定sendmail,基本上sendmail會設定多半是為了寄系統信和收垃圾信(喂!!?)

[Rocky9] Sphinx 3支援中文 + Docker + PHP7 使用docker建置sphinxsearch 3

[Centos7] 把帳號新增移除具有root權限等級的sudoer 把帳號新增或移除具有root權限等級的sudoer

隨機好文

[MAC] 截取螢幕畫面的方法 截取螢幕畫面的方法,在MAC中叫作螢幕快照,英文是screenshot

沒有非誰做不可的事,也沒有不可被取代的人 沒有非誰做不可的事,也沒有不可被取代的人

APACHE的記錄檔格式 LogFormat 語法 在APACHE中有定義一些記錄的語法模版 在 /etc/httpd/conf/httpd.conf 中: LogForm

[Centos6] 安裝wordpress Centos 6下安裝wordpress,非常簡單

[MySQL/Mariadb] console 將查詢結果輸出到檔案 在mysql 的console中該如何將查詢結果輸出到檔案?