[精讚] [會員登入]
2337

[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

你可能感興趣的文章

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

[LINUX] 利用 usermod 修改使用者的參數和資料 使用指令 usermod 修改使用者的參數和資料

[Centos7] 安裝apache+php7+mariadb10+selinux Centos7 安裝apache+php7+mariadb10+selinux

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

[Centos7] 安裝nodejs8+yarn 安裝nodejs 8+ yarn的過程記錄

[Centos7] audit 服務 在紅帽和suse的linux中有一個audit這樣的daemon,寫入的是核心層的記錄。

隨機好文

「許功蓋」的字以及源由 有玩過電腦一段時間的人,都聽過這個人(有一天我才發現7年級的竟然都不認識這個

[Mysql/MariaDB] 查看資料庫所占空間 查看資料庫在磁碟中所占空間

[CKeditor4] 修改特殊字元 CKeditor4 中設定自己想用的特殊字元

FTP的主動模式及被動模式 FTP的服務常會被防火牆擋掉,所以對於主動和被動模式,需要很了解

[HTLM5] 表單number和range輸入類型 介紹HTML5和數字有關的輸入類型number/range 等類型