[精讚] [會員登入]
2345

[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

你可能感興趣的文章

[Centos7] 新的防火牆firewalld Centos7新的防火牆firewalld 和前面的iptables有很大的不同

[Centos8] 網頁化的系統管理介面 cockpit Centos8 提供一個網頁化的管理介面,稱為駕駛艙,值得一試

[CentOS] 新增修改及刪除使用者 新增、修改、刪除使用者和群組

[CENTOS7] 使用 logrotate 來整理wildfly日誌檔 解決 wildfly 的日誌檔不斷長大的問題

使用dnstop 來觀察dns運作的情形 dnstop是非常方便的工具,可以觀察即時的dns查詢。 安裝 yum install dnstop

[bc] linux 的計算機bc 如何計算帶小數點的指數 用 bc 來計算帶小數點的指數,得轉個彎才行

隨機好文

使用Google尋找你的手機 這近發現google竟然可以用來找android的手機,而且不需要經過什麼設定或安裝軟體。

為什麼要重造輪子? 什麼輪子?造什麼輪子?我為什麼要重造輪子?

[PHP] 檢查檔案是否是圖檔 使用getimagesize函數檢查檔案是否是圖檔

正則表達式:Email名稱防止連續輸入點(.)及下底線(_) Email的名稱中要允許特殊符號,但又不允許連續出現的正則表達式

海棉寶寶超泡杯演奏的sweet victory 章魚哥和海棉寶寶在超泡杯的演奏歌曲