[精讚] [會員登入]
2342

[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

你可能感興趣的文章

Linux shell 的date表示法 linux下SHELL中的date表示法

[CENTOS7 8] 查看記憶體 linux 中查看記憶體狀態指令整理

[Rocky9+Docker] Mariadb Cluster + HAPROXY + Docker compose 把mariadb多個節點放在同一個docker中建立叢集的作法到底可不可行?

[Centos8] 利用nmcli 設定ipv6 位址 Centos7之後修改網路設定變得比較麻煩一點,此篇介紹使用nmcli指令的方法

[APACHE] PHP<5.5及 PHP>=5.5 安裝APC php5.5版後的apc只能手動安裝,此文包含php<5.5及php>=5.5兩種安裝方法

[Centos7 8] postfix+DKIM 設定 信件總是被退?希望別的mail server相信我寄出的信?那麼你可以設定dkim。

隨機好文

[jQuery] textarea 的取值和給值 HTML 的 TEXTAREA 標籤若要用 jquery 取值,不能使用 .text() 或 .html() ,使用 .

SELinux 常用指令和檔案 在Redhat系列中,Centos5以後加入了selinux,他並沒有這麼可怕,不必每次看到Selinux ,就想把他

[Freebsd] 使用 ADSL 撥接上網 Freebsd上要使用 ADSL 撥接上網,該如何設定?

Linux shell 的date表示法 linux下SHELL中的date表示法

看懂DSUB DVI HDMI USB等各式影音接頭 看懂DSUB DVI HDMI等各式影音接頭