當前位置:首頁 » 雲伺服器 » linux搭建http代理伺服器

linux搭建http代理伺服器

發布時間: 2022-04-21 01:21:01

① 如何在linux系統搭建http服務

1、安裝ftp服務端,方便你從客戶端上傳文件。linux上一般安裝vsftp.VSFTP的軟體安裝包是: vsftpd-2.2.2-12.el6_5.1.i686.rpm
查詢:#rpm -q vsftpd
安裝:#rpm -ivh vsftpd-2.2.2-12.el6_5.1.i686.rpm或者直接yum install vsftpd
啟動、停止及重啟VSFTP的命令: #service vsftpd start/stop/restart
配置文件:
/etc/vsftpd/vsftpd.conf //主配置文件
/etc/vsftpd.ftpusers //被禁止登錄FTP的用戶文件
/etc/vsftpd.user_list //允許登錄FTP的用戶文件
a、將登錄後的用戶限制在本地家目錄下:
#vi /etc/vsftpd/vsftpd.conf
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
新建受限用戶的列表文件並加入受限用戶名
#vi /etc/vsftpd.chroot_list
raykeso
重啟ftp服務
#service vsftpd restart
2、安裝apache,開啟目錄索引,這樣你就可以瀏覽和下載文件。
apache配置文件
<Directory "I:/build/dist"> #設置瀏覽文件的目錄
Options Indexes #開啟目錄列表索引模式Order allow,deny
Allow from all
</Directory>

② 如何在linux環境下搭建Tor代理伺服器

以下的安裝在是centos6.5_64x系統上進行的。
centos系統默認yum源是找不到tor安裝包的,若yum install tor提示未找到安裝包,需要添加epel yum外部源。EPEL (Extra Packages for Enterprise Linux) 是Fedora小組維護的一個軟體倉庫項目,為RHEL/CentOS提供他們默認不提供的軟體包。這個源兼容RHEL及像CentOS和Scientific Linux這樣的衍生版本。
安裝步驟如下:
yum install tor 若是提示未找到tor安裝包,查看 /etc/yum.repos.d/下是否有epel.repo文件,若沒有,說明系統未添加epel yum外部源,需要手動添加,若已經添加epel外部源,可直接安裝tor,則跳過2-6步驟。
根據你的操作系統,從網站獲取對應的epel 的安裝包,centos6.5_64位系統獲取的安裝包如下 (查看系統版本指令lsb_release -a && uname -a)wgethttp://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -ivh epel-release-6-5.noarch.rpm
安裝成功後可看到 /etc/yum.repos.d/目錄下多了epel.repo 與epel-testing.repo文件
yum clean all
yum makecache
yum install tor

③ linux 如何設置代理

linux設置代理linux系統設置yum,wget,rpm命令使用代理:1.Using
yum
with
a
proxyserver---------------------------------------To
enable
yum
operations
to
use
aproxy
server
you
should
first
add
the
following
parameter
to
/etc/yum.conf
proxy=http://yourproxy:8080/
where
yourproxy
is
the
name
of
the
proxy
server
you
want
to
access
and
8080
isthe
proxy
port.
If
the
server
requires
authentication
you
can
specify
the
logincredentials
like:proxy=http://username:password@yourproxy:8080/---------------------------------------2.
The
rpm
package
manager
makesuse
of
the
proxy
environment
variable.
This
can
be
set
system
wide
in
/etc/profile
or
user
specific
in
~/.bash_profile:export
http_proxy=http://yourproxy:8080/export
ftp_proxy=http://yourproxy:8080/---------------------------------------3.
To
use
wget
throug
a
proxy
serveradd
the
following
lines
to
/etc/wgetrc
http_proxy
=
http://yourproxy:8080/
ftp_proxy
=
http://yourproxy:8080/

④ 如何在linux上用squid搭建代理伺服器

1、首先下載:squid-3.2.9.tar.bz2
2、上傳到伺服器後解壓
解壓: tar -vxjf squid-3.2.9.tar.bz2
解壓後生成目錄:squid-3.2.9
進入目錄翻看文檔INSTALL:
xxxx> more INSTALL
To build and install the Squid Cache, type:
% ./configure --prefix=/usr/local/squid
% make all
% make install
To run a Cache, you will need to:
1. customize the squid.conf configuration file:
% vi /usr/local/squid/etc/squid.conf
2. Initalise the cache:
% /usr/local/squid/sbin/squid -z
3. start the cache:
% /usr/local/squid/sbin/squid
If you want to use the WWW interface to the Cache Manager,
the cachemgr.cgi program into your httpd server's cgi-bin
directory.
3、安裝步驟:
./configure --prefix=/usr/local/squid
make all
sudo make install(因為要拷貝到系統目錄,需要root許可權,所以sudo了,你也可以root登錄執行,我是Ubuntu的系統,所以用sudo,有root許可權就行)
檢查配置文件:
sudo vi /usr/local/squid/etc/squid.conf
配置項1:
# Squid normally listens to port 3128
http_port 3128
配置項2:
acl localnet src 192.168.0.0/16
http_access allow localnet
配置項3:
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /usr/local/squid/var/cache/squid 100 16 128
cache_mem 32 MB (這一條必須配置)
否則就會遭遇報錯: 2013/10/12 16:16:55 kid1| WARNING cache_mem is larger than total disk cache space!
安裝好了以後,系統中新建了一個用戶squid,在組中一查,發現屬於nobody組的:
cat /etc/passwd|grep squid
cat /etc/group|grep 65534
安裝squid的所在目錄是:/usr/local/squid
直接改了所屬用戶為squid:nobody
sudo chown -Rf squid:nobody /usr/local/squid
建立cache的時候,對下面目錄需要nobody用戶許可權:
sudo chown -Rf nobody /usr/local/squid/var/cache/
sudo chown -Rf nobody /usr/local/squid/var/logs/
否則會遭遇:
WARNING: Cannot write log file: /usr/local/squid/var/logs/cache.log
FATAL: Failed to make swap directory /usr/local/squid/var/cache/squid/00: (13) Permission denied
初始化squid.conf里配置的cache目錄,就是建立了一堆的目錄:
sudo /usr/local/squid/sbin/squid -z
在前台啟動squid,並輸出啟動過程
sudo /usr/local/squid/sbin/squid -N -d1
顯示ready to server reques,則啟動成功。可以鍵入ctrl+c,停止squid,並以後台運行的方式啟動。
沒有在配置文件中配置DNS,而是在 /etc/resolv.conf 中配置:
domain site
nameserver x.x.x.x
所以列印出來的日誌中就這樣的:
2013/10/12 16:42:13| Adding nameserver x.x.x.x from /etc/resolv.conf
squid從這個配置文件中讀取了dns配置來用。
啟動squid後台運行
sudo /usr/local/squid/sbin/squid -s
檢查一下進程是否存在:ps -ef|grep squid
通過squid客戶端查看squid運行狀態
/usr/local/squid/bin/squidclient -h 127.0.0.1 -p 3128 mgr:info
那台不能上網的機器配置如下:
export http_proxy=http://192.168.199.235:3128/
可以把這句寫到啟動文件中,比如什麼.profile或者.bashrc,或者/etc/profile等等。
取消:unset http_proxy
最後測試一下能不能上網了。

⑤ 如何在Linux上用Squid搭建代理伺服器

squid是所有服務裡面最簡單的我覺得
以RHEL7為例,它分成了正向代理和反向代理,正向代理里又分「標准正向代理」,「ACL訪問控制」以及「透明正向代理」。下面是標准正向代理

16.3 正向代理

16.3.1 標准正向代理

Squid服務程序軟體包在正確安裝並啟動後默認就已經可以為用戶提供標准正向代理模式服務了,而不需要單獨再去修改配置文件或者其他操作,咱們可以立即在Windows7系統的客戶端主機上面打開任意一款瀏覽器,然後點擊Internet選項標簽,如圖16-4所示:
[root@linuxprobe ~]# systemctl restart squid
[root@linuxprobe ~]# systemctl enable squid
ln -s '/usr/lib/systemd/system/squid.service' '/etc/systemd/system/multi-user.target.wants/squid.service'
用戶要想使用Squid服務程序提供的標准正向代理模式服務就必須在瀏覽器中填寫伺服器的IP地址以及埠號信息,因此咱們還需要依次點擊連接標簽後點擊區域網設置選項,如圖16-5與圖16-6所示填寫伺服器信息後保存退出配置向導。

用戶只需要在瀏覽器中簡單的填寫配置信息就可以開始享用Squid服務程序提供的代理服務了,此時作為一個網卡為僅主機模式(Hostonly)的虛擬機,開始也奇跡般的能夠上網瀏覽了,這一切都是托代理伺服器轉發的功勞哦~

如此公開而沒有密碼驗證的代理服務終歸覺得不放心,萬一有其他人也來「蹭網」咱們的代理服務怎麼辦呢?Squid服務程序默認的會佔用3128、3401與4827等埠號,咱們可以將默認佔用的埠號修改成其他值,這樣應該能起到一定的保護作用吧~同學們都知道在Linux系統配置服務程序就是在修改該服務的配置文件,因此直接在/etc目錄中找到和squid服務程序同名目錄中的配置文件,把其中http_port參數後面原有3128修改為10000,這樣即是將Squid服務程序的代理服務埠修改成了新值,當然最後不要忘記再重啟下服務程序哦~:
[root@linuxprobe ~]# vim /etc/squid/squid.conf
………………省略部分輸出信息………………
45 #
46 # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
47 #
48
49 # Example rule allowing access from your local networks.
50 # Adapt localnet in the ACL section to list your (internal) IP networks
51 # from where browsing should be allowed
52 http_access allow localnet
53 http_access allow localhost
54
55 # And finally deny all other access to this proxy
56 http_access deny all
57
58 # Squid normally listens to port 3128
59 http_port 10000
60
http_port 10000
………………省略部分輸出信息………………
[root@linuxprobe ~]# systemctl restart squid
[root@linuxprobe ~]# systemctl enable squid
ln -s '/usr/lib/systemd/system/squid.service' '/etc/systemd/system/multi-user.target.wants/squid.service'

同學們有沒有突然覺得這一幕似曾相識?在前面的第十章10.5.3小節咱們學習過基於埠號來部署httpd服務程序的虛擬主機功能,當時在編輯完配置文件後重啟服務程序時被直接提示報錯了,雖然現在重啟服務程序並沒有直接報錯,但其實客戶並不能使用代理服務呢,SElinux安全子系統認為Squid服務程序使用3128埠號是理所應當的,默認策略規則中也是允許的,但現在卻在嘗試使用新的10000埠號,這是原本並不屬於Squid服務程序應該使用的系統資源,因此咱們需要手動把新的埠號添加到squid服務程序在SElinux域的允許列表中即可:
[root@linuxprobe ~]# semanage port -l | grep -w -i squid_port_t
squid_port_t tcp 3128, 3401, 4827
squid_port_t udp 3401, 4827
[root@linuxprobe ~]# semanage port -a -t squid_port_t -p tcp 10000
[root@linuxprobe ~]# semanage port -l | grep -w -i squid_port_t
squid_port_t tcp 10000, 3128, 3401, 4827
squid_port_t udp 3401, 4827

更多的圖文信息以及其他的代理方式你可以看下http://www.linuxprobe.com/chapter-16.html#161這篇,講的非常詳細,相信能解決你的問題

⑥ 如何在Linux下使用代理伺服器

linux自帶firefox 打開FireFox,編輯->首選項->常規->連接 設置FF訪問網際網路的方式 連接設置 手動配置代理 然後輸入代理伺服器IP和埠號即可。

⑦ linux系統下怎麼搭建網站伺服器

具體方法如下:

1、使用putty或類似的SSH工具登錄伺服器(本地安裝跳過);

⑧ 如何在linux配置http代理

可以在你的用戶家目錄下的.bashrc的最後加上:
export http_proxy=your_proxy_address:port
export https_proxy=your_proxy_address:port
export ftp_proxy=your_proxy_address:port

直接在terminal窗口輸入這些也可以。

熱點內容
c語言中a10什麼意思 發布:2024-04-27 10:45:43 瀏覽:57
物聯網中ftp是什麼意思 發布:2024-04-27 10:41:17 瀏覽:985
銀行密碼保護在哪裡 發布:2024-04-27 10:25:23 瀏覽:188
tomcat源碼導入eclipse 發布:2024-04-27 10:25:15 瀏覽:193
android的api 發布:2024-04-27 10:23:39 瀏覽:682
官式訪問 發布:2024-04-27 10:04:00 瀏覽:521
國產高配置有哪些 發布:2024-04-27 09:18:26 瀏覽:947
建行手機app忘記密碼如何修改 發布:2024-04-27 08:58:59 瀏覽:393
蟻群演算法的數學模型 發布:2024-04-27 08:58:39 瀏覽:994
androidactivity生命 發布:2024-04-27 07:33:48 瀏覽:84