jenkins 修改埠後無法啟動的解決思路
一、問題
jenkins網站繫結域名後直接通過域名訪問使用的是8080埠,為方便使用者訪問因此須監聽80埠,而為了安全起見linux一般不用root身份執行,綜上,需要以普通使用者來執行監聽80埠時就會啟動失敗,報沒有許可權,因為linux只有root身份才能監聽1024以下的熟知埠。
二、解決
(以下未經驗證)
There are a few different solutions to work around this:
Install and configure Apache or nginx as a reverse proxy server, which can be started as root to open the port, and then downgrade its privileges back to a normal user.
Set up a firewall on the server using iptables or an alternative, so that the lower port number is forwarded internally to a higher port number listened by Confluence.
Use jsvc, which is able to open ports as root, and then downgrade privileges.
Use authbind to grant privileges for a non-root user to open a privileged port.
(以驗證可行)
通過firewalld進行埠轉發
開啟firewalld防火牆
systemctl start firewalld
開機啟動
systemctl enable firewalld
放行80埠
firewall-cmd --permanent --zone=public --add-service=http
轉發80埠流量到8080
firewall-cmd --permanent --add-forward-port=port=80:proto=tcp:toport=8080
立即生效
firewall-cmd --reload