Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24
ftp – unethost無限空間虛擬主機 技術分享部落格

如何解決搬網站時,遇到的網路速度不均的問題

近期有不同站長,反應不同的網速問題,
都是在備份資料中所撞到的,今天特地開一篇做一個整理。

閱讀全文 如何解決搬網站時,遇到的網路速度不均的問題

改用 winscp 登入 ftp 管理空間 (winscp教學)

我們在如何切換filezilla的被動模式及主動模式? 這篇文章中,教導大家切換ftp程式的被動模式或主動模式,藉以解決ftp無法瀏覽到資料的問題。 不過如果還是無法解決,那我們建議可以使用 winscp ,如果使用的主機有支援ssh的話。為了方便大家使用,unethost.om虛擬主機預設就有開啟ssh功能。
閱讀全文 改用 winscp 登入 ftp 管理空間 (winscp教學)

webftp

虛擬主機因為是多人共用一台實體主機,當主機遭受DDoS攻擊,或是剛好執行一些備分的工作時,機器的負載總是難免會偶爾有上昇的時候。當機器的負載上昇時,除了網頁伺服器的反映速度會變慢一些之外,有時候比較嚴重的問題是,ftp會不停地斷線。

在一次偶然的情形下,我用filezilla會不停地斷線時,用webftp卻可以順利地上傳檔案!

這樣的一件事,讓我不由得開始重新檢視webftp和ftp不同之處。unethost.com的webftp是安裝在美國的主機上的。當使用者使用webftp時,其實檔案的傳輸是先從客戶端,走http的傳輸協定到webftp所在的機器,再透過ftp傳輸協定到真實的目標機器上。所以是兩階段式的。前面這一段往往是最容易逾時(timeout),最容易有掉封包(packet loss)的。原因是前面的這一段是從台灣連線到美國,所以延遲(delay)會比較長。考慮到前面這一段的傳輸有這種特性之後,就不難理解,為何webftp在這種條件下可以有較佳的表現了。http這個傳輸協定由於有較多的超文件標記(meta tag)本身對於這種延遲長、容易掉封包的連線,本來就有較佳的表現。而webftp很巧妙地剛好可以利用http這個傳輸協定來處理前一段的連線,所以就可以在filezilla動彈不得的時候,依然順利地達成上傳檔案的任務。

如何讓主機的防火牆csf不會誤擋到ftp

最近公司的客戶,用ftp連線時,一直被主機的防火牆誤判為攻擊。這個問題是這樣子產生的:公司的防火牆是用csf firewall這個套件,而這個套件如果沒有特別設定的話,對於ftp,很容易誤擋。

根據csf的文件,linux的iptables如果ip_conntrack和ip_conntrack_ftp沒有正常的運作時,FTP的被動模式就無法順利地運作。在這種條件下,我們必須設定ftp的被動通訊埠在防火牆上是被視為可連接的。

以pure-ftp為例子:
(1) 必須修改/etc/pure-ftpd.conf,取消
PassivePortRange 30000 35000
這一行的註解 (注意:此處的port range要和之後步驟,設定CSF的port range相符合)
(2) 重新啟動pure-ftp
(3) 修改csf的config檔 /etc/csf/csf.conf
在 TCP_IN中,加上30000:35000,例如:
# Allow incoming TCP ports
TCP_IN = “20,21,22,25,53,80,110,143,443,465,587,993,995,2077,2078,2082,2083,2086,2087,2095,2096,1891,30000:35000″
(4) 重新啟動csf

這樣子設定之後,防火牆才能和ftp完美的合作。

參考資料:http://www.configserver.com/free/csf/readme.txt

延伸閱讀:如何查看linux server連線port是否異常?

13. A note about FTP Connection Issues
######################################

It is important when using an SPI firewall to ensure FTP client applications
are configured to use Passive (PASV) mode connections to the server.

On servers running Monolithic kernels (e.g. VPS Virtuozzo/OpenVZ and custom
built kernels) ip_conntrack and ip_conntrack_ftp iptables kernel modules may
not be available or fully functional. If this happens, FTP passive mode (PASV)
won't work. In such circumstances you will have to open a hole in your firewall
and configure the FTP server to use that same hole.

For example, with pure-ftpd you could add the port range 30000:35000 to TCP_IN
and add the following line to /etc/pure-ftpd.conf and then restart pure-ftpd:
PassivePortRange	30000 35000

For example, with proftpd you could add the port range 30000:35000 to TCP_IN
and add the following line to /etc/proftpd.conf and then restart proftpd:
PassivePorts	30000 35000

FTP over SSL/TLS will usually fail when using an SPI firewall. This is because
of the way the FTP protocol established a connection between client and server.
iptables fails to establish a related connection when using FTP over SSL
because the FTP control connection is encrypted and so cannot track the
relationship between the connection and the allocation of an ephemeral port.

If you need to use FTP over SSL, you will have to open up a passive port block
in both csf and your FTP server configuration (see above).

Perversely, this makes your firewall less secure, while trying to make FTP
connections more secure.