最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

centos下簡(jiǎn)單配置安裝Squid 3.0反向代理

 更新時(shí)間:2010年12月25日 16:58:20   作者:  
以下安裝及配置均為Sudu所在公司應(yīng)用中使用的腳本,希望高手們能指正我的一些不足。如果測(cè)試過(guò)程中發(fā)現(xiàn)了問(wèn)題請(qǐng)回復(fù)或者聯(lián)系我。

安裝篇:

本教程應(yīng)用環(huán)境為干凈centos 5.5 ,預(yù)先分好并加載/data分區(qū),并且關(guān)閉selinux及iptables

首先修改文件描述符并設(shè)定臨時(shí)端口范圍,這些設(shè)置重啟后生效

復(fù)制代碼 代碼如下:

cat >> /etc/security/limits.conf <<DDD
* soft nofile 8192
* hard nofile 20480
DDD

cat >> /etc/sysctl.conf <<DDD
#set temp port range
net.ipv4.ip_local_port_range = 32768 61000
DDD

init 6

確認(rèn)修改是否正確
復(fù)制代碼 代碼如下:

[root@sudutest ~]# ulimit -n
8192
[root@suduotest ~]# sysctl -n net.ipv4.ip_local_port_range
net.ipv4.ip_local_port_range = 32768 61000

添加squid專用賬戶
復(fù)制代碼 代碼如下:

groupadd squid
useradd -g squid -s /bin/false -M squid

添加日志目錄、設(shè)置緩存和日志目錄的權(quán)限
復(fù)制代碼 代碼如下:

mkdir /data/squidlog/
chown -R squid.squid /data

然后上傳或者wget squid3.0軟件tar包,tar zxvf解壓,并且進(jìn)入解壓后的目錄安裝編譯
復(fù)制代碼 代碼如下:

./configure –prefix=/usr/local/squid3 –enable-async-io=100 –with-pthreads –enable-storeio="aufs,diskd,ufs" –enable-removal-policies="heap,lru" –enable-icmp –enable-delay-pools –enable-useragent-log –enable-referer-log –enable-kill-parent-hack –enable-arp-acl –enable-default-err-language=Simplify_Chinese –enable-err-languages="Simplify_Chinese English" –disable-poll –disable-wccp –disable-wccpv2 –disable-ident-lookups –disable-internal-dns –enable-basic-auth-helpers="NCSA" –enable-stacktrace –with-large-files –disable-mempools –with-filedescriptors=65535 –enable-ssl –enable-x-accelerator-var
make
make install
make install-pinger

至此squid已經(jīng)成功安裝了,然后大家自己所需的/usr/local/squid3/etc/squid.conf 配置文件,我這邊的配置文件將會(huì)在本文末尾貼出來(lái)供大家研究。

寫(xiě)好配置文件后執(zhí)行下面的命令初始化cache目錄
/usr/local/squid3/sbin/squid -z
然后運(yùn)行squid,注:-D參數(shù)用來(lái)跳過(guò)DNS檢測(cè)
/usr/local/squid3/sbin/squid -D
最后設(shè)置squid開(kāi)機(jī)自動(dòng)啟動(dòng)
echo "/usr/local/squid3/sbin/squid -D " >>/etc/rc.local
維護(hù)篇:

以下是squid常用的命令
如果修改過(guò)配置文件,則用下面的命令重讀配置文件(即時(shí)生效)
/usr/local/squid3/sbin/squid -k reconfigure
檢查配置文件配置的語(yǔ)法是否正確
注:只有像這樣的“cache_cf.cc(346) squid.conf:14 unrecognized: 'http1_port'”才是語(yǔ)法錯(cuò)誤,
“WARNING: use of 'reload-into-ims'……”這類提示屬于意見(jiàn)建議,可以忽略。
/usr/local/squid3/sbin/squid -k parse
查看squid的日志和進(jìn)程,看squid運(yùn)行是否正常
復(fù)制代碼 代碼如下:

ps -ef |awk '/^squid/'
cat /data/squidlog/cache.log
/usr/local/squid3/sbin/squid -k check ;echo $?

關(guān)閉squid
發(fā)出關(guān)閉信號(hào),等會(huì)話結(jié)束后徹底關(guān)閉
/usr/local/squid3/sbin/squid -k shutdown
關(guān)閉squid(更高優(yōu)先級(jí),直接關(guān)閉squid)
/usr/local/squid3/sbin/squid -k interrupt

關(guān)閉squid(最高優(yōu)先級(jí),直接殺死squid進(jìn)程)
/usr/local/squid3/sbin/squid -k kill
滾動(dòng)日志文件
/usr/local/squid3/sbin/squid -k rotate
設(shè)置每周二凌晨四點(diǎn)30分自動(dòng)滾動(dòng)日志


echo "30 4 * * 2 root /usr/local/squid3/sbin/squid -k rotate " >>/etc/crontab

目前應(yīng)用中的squid.conf文件,由于日志文件增長(zhǎng)很快,所以直接輸出到/dev/null丟棄掉了
復(fù)制代碼 代碼如下:

#basic
cache_effective_user squid
cache_effective_group squid
pid_filename /usr/local/squid3/var/logs/squid.pid
visible_hostname squid.678114.com
cache_mgr sudu@sudu.us
error_directory /usr/local/squid3/share/errors/Simplify_Chinese
icon_directory /usr/local/squid3/share/icons
mime_table /usr/local/squid3/etc/mime.conf
hosts_file /etc/hosts

acl DEIpadd dstdom_regex [0-9]$
http_access deny DEIpadd

cache_replacement_policy lru
memory_replacement_policy lru

http_port 80 vhost vport

cache_mem 4024 MB
maximum_object_size_in_memory 5120 KB

icp_port 0

#.cache_dir
cache_dir aufs /data/cache 50000 64 128

max_open_disk_fds 0
maximum_object_size 20 MB

#.cache_peer
cache_peer 125.76.225.44 parent 80 0 no-query originserver no-digest name=all
cache_peer_domain all .678114.com

#acl
acl Safe_ports port 80
acl SSL_ports port 443
acl LanSrc src 192.168.100.0/24
acl webdomain dstdomain .678114.com
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow LanSrc
http_access allow webdomain
http_access deny all

#refresh_pattern
refresh_pattern -i /$ 15 90% 600 reload-into-ims
refresh_pattern -i .html$ 15 90% 600 reload-into-ims
refresh_pattern -i .htm$ 15 90% 600 reload-into-ims
refresh_pattern -i .shtml$ 15 90% 600 reload-into-ims
refresh_pattern -i .hml$ 15 90% 600 reload-into-ims
refresh_pattern -i .gif$ 1440 90% 129600 reload-into-ims
refresh_pattern -i .swf$ 1440 90% 129600 reload-into-ims
refresh_pattern -i .jpg$ 1440 90% 129600 reload-into-ims
refresh_pattern -i .png$ 1440 90% 129600 reload-into-ims
refresh_pattern -i .bmp$ 1440 90% 129600 reload-into-ims
refresh_pattern -i .js$ 120 90% 129600 reload-into-ims
refresh_pattern -i .css$ 120 90% 129600 reload-into-ims
refresh_pattern -i .wma$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .zip$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .mp3$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .rar$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .rm$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .flv$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .rar$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .rm$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .avi$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .3gp$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .mp4$ 1440 90% 21600 reload-into-ims
refresh_pattern -i .wmv$ 1440 90% 21600 reload-into-ims

#keepalived
client_persistent_connections off
server_persistent_connections on

#log
emulate_httpd_log on
logformat web1 %{X-Forwarded-For}>h %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %<st "%{Referer}>h" "%{User-Agent}>h" %Ss:%Sh
cache_log /data/squidlog/cache.log
cache_access_log /dev/null web1
cache_store_log /dev/null
strip_query_terms off
logfile_rotate 10

#other
forwarded_for on
log_icp_queries off
via off
httpd_suppress_version_string off
ie_refresh off
tcp_recv_bufsize 32 KB
ipcache_size 1024
ipcache_low 90
ipcache_high 95
cache_swap_low 80
cache_swap_high 90
request_header_max_size 128 KB

quick_abort_min 20 KB
quick_abort_max 20 KB
quick_abort_pct 95

connect_timeout 1 minute
negative_ttl 0 minutes

read_timeout 30 seconds
pconn_timeout 120 seconds
half_closed_clients off
client_lifetime 10 minutes
shutdown_lifetime 5 seconds

hierarchy_stoplist cgi-bin ?
access_log /dev/null squid

本文首發(fā)于http://www.sudu.us/simple-to-install-squid-3-0-reverse-proxy-configuration/

相關(guān)文章

  • 淺談ubuntu 使用securecrt vi編輯出現(xiàn)的問(wèn)題

    淺談ubuntu 使用securecrt vi編輯出現(xiàn)的問(wèn)題

    下面小編就為大家?guī)?lái)一篇淺談ubuntu 使用securecrt vi編輯出現(xiàn)的問(wèn)題。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-01-01
  • Apache HTTP 服務(wù)器的安全配置指南(最新推薦)

    Apache HTTP 服務(wù)器的安全配置指南(最新推薦)

    Apache作為最廣泛使用的Web服務(wù)器之一,其安全配置至關(guān)重要,本文將探討如何通過(guò)一系列措施加強(qiáng)Apache的安全性,包括配置SSL/TLS、設(shè)置訪問(wèn)控制、防止常見(jiàn)攻擊等,感興趣的朋友一起看看吧
    2024-12-12
  • CentOS7下實(shí)現(xiàn)終端輸入中文設(shè)置詳解

    CentOS7下實(shí)現(xiàn)終端輸入中文設(shè)置詳解

    這篇文章主要給大家介紹了關(guān)于CentOS7下實(shí)現(xiàn)終端輸入中文設(shè)置的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用CentOS7系統(tǒng)具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • linux普通用戶su root切換提示沒(méi)有文件或目錄的解決方法

    linux普通用戶su root切換提示沒(méi)有文件或目錄的解決方法

    這篇文章主要介紹了linux普通用戶su root切換提示沒(méi)有文件或目錄的解決方法,需要的朋友可以參考下
    2017-07-07
  • 在 Ubuntu 上安裝 Protobuf 3 的教程詳解

    在 Ubuntu 上安裝 Protobuf 3 的教程詳解

    這篇文章主要介紹了在 Ubuntu 上安裝 Protobuf 3遇到問(wèn)題及解決方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下
    2019-06-06
  • linux安裝RocketMQ實(shí)例步驟

    linux安裝RocketMQ實(shí)例步驟

    在本篇文章里小編給大家整理的是關(guān)于linux安裝RocketMQ實(shí)例步驟內(nèi)容,需要的朋友們可以參考下。
    2020-02-02
  • Linux系統(tǒng)擴(kuò)容根目錄磁盤(pán)空間的操作方法

    Linux系統(tǒng)擴(kuò)容根目錄磁盤(pán)空間的操作方法

    這篇文章主要介紹了Linux系統(tǒng)擴(kuò)容根目錄磁盤(pán)空間的操作方法,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-07-07
  • Linux系統(tǒng)查看網(wǎng)卡配置信息方式

    Linux系統(tǒng)查看網(wǎng)卡配置信息方式

    這篇文章主要介紹了Linux系統(tǒng)查看網(wǎng)卡配置信息方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-03-03
  • linux模糊查找文件用什么命令比較好

    linux模糊查找文件用什么命令比較好

    這篇文章主要給大家介紹了關(guān)于linux模糊查找文件用什么命令比較好的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用linux系統(tǒng)具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-08-08
  • Linux中的screen命令使用詳解

    Linux中的screen命令使用詳解

    這篇文章主要介紹了Linux中的screen命令使用詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-12-12

最新評(píng)論

浦城县| 平遥县| 厦门市| 稻城县| 天气| 麻阳| 永年县| 揭阳市| 巢湖市| 甘谷县| 常州市| 丹巴县| 噶尔县| 林周县| 扎鲁特旗| 乐昌市| 阿克陶县| 常宁市| 页游| 调兵山市| 巫溪县| 会泽县| 板桥市| 湘西| 英德市| 沙洋县| 平阴县| 奉新县| 潞城市| 广平县| 政和县| 鹤壁市| 大丰市| 石林| 疏附县| 临湘市| 邯郸县| 江川县| 合作市| 淮南市| 兴化市|