2012-06-28 99 views
7

我在我的Ubuntu服務器上安裝了jenkins,我只用sudo apt-get install jenkins安裝了jenkins,因此,現在可以從指向我的方框的所有域中訪問jenkins,只需將:8080在URL上。防止Jenkins在端口8080上訪問

我已經成功地配置Apache來代理詹金斯我可以從ci.mydomain.com訪問它,但我不能工作了如何防止詹金斯被在8080端口上

這裏訪問的是我的Apache的conf:

<VirtualHost xx.xx.xx.xx:80> 
    ServerAdmin [email protected] 
    ServerName ci.mydomain.com 

    ProxyPass  /http://localhost:8080/ 
    ProxyPassReverse/http://localhost:8080/ 
    ProxyRequests  Off 

    <Proxy http://localhost:8080/*> 
     Order deny,allow 
     Allow from all 
    </Proxy> 
</VirtualHost> 

我按照Ubuntu說明here,但他們似乎沒有任何效果。

+0

你可以用'iptables',因爲它是Ubuntu的,爲阻止端口8080的所有非本地訪問所有非本地訪問。 'iptables -A INPUT -t tcp -dport 8080 -s localhost -j ACCEPT'和'iptables -A INPUT -t tcp -dport 8080 -j DROP' – ionFish

+0

@ionFish謝謝,它抱怨'--dport'選項雖然無法識別,添加此作爲答案也許? – Dunhamzzz

回答

10

你可以使用iptables的,因爲它是Ubuntu的,爲阻止端口8080

iptables -A INPUT -p tcp --dport 8080 -s localhost -j ACCEPT 
iptables -A INPUT -p tcp --dport 8080 -j DROP 
+0

我得到的迴應是'iptables v1.4.12:未知選項「--dport」' – Dunhamzzz

+0

我會稍微研究一下,在這一秒我有重要的事情要做。 – ionFish

+0

它是'-p'而不是'-t'導致dport問題,我已經更新了你的回答 – Dunhamzzz

相關問題