个人工具
登录
查看“UbuntuHelp:Squid/Customize”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:Squid/Customize”的源代码
来自Ubuntu中文
←
UbuntuHelp:Squid/Customize
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/Squid/Customize}} {{Languages|UbuntuHelp:Squid/Customize}} == Squid is ugly == Squid error pages are ugly, here's how you can change it. === Configuration === This assumes you already have a squid proxy installation which is up and running. Squid is serving static pages on errors, denies or on other problematic situations. All those pages can be found in `/usr/share/squid/errors/`. The pages are stored in folders with language names. Those folders are actually the squid translated pages. We can change the language squid serves pages by editing `/etc/squid/squid.conf` configuration file. Find the `error_directory` directive and change it's value to the path where your language files are stored. <pre><nowiki> error_directory /usr/share/squid/errors/Romanian </nowiki></pre> Ok, but this doesn't make Squid error pages prettier! To get this issue fixed you can edit every page inside the error pages directory to suit your needs, or, you can use [[UbuntuHelp:sed|sed]]! === Custom pages === Make a copy of your language folder first. <pre><nowiki> mkdir /etc/squid/pages/ cp -r /usr/share/squid/errors/Romanian /etc/squid/pages/ </nowiki></pre> Now cause it is [[UbuntuHelp:HTML|HTML]] the pages inside that folder are written in, we can use [[UbuntuHelp:CSS|CSS]] to prettify those. Here's a simple [[UbuntuHelp:sed|sed]] usage to quickly search and replace the default squid error pages CSS tag with some custom CSS: <pre><nowiki> sed -i 's/<STYLE type="text\/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--><\/STYLE>/<STYLE type="text\/css"><!--BODY{width:70%; margin: 50px auto;font-family:Georgia,serif; color: #4a4a4a}a:link{color:#cc0000}a:visited{color:#666}--><\/STYLE>/g' * </nowiki></pre> Now edit again your squid config file and point `error_directory` to the new location of your error pages. Reload squid: <pre><nowiki> invoke-rc.d squid reload </nowiki></pre> Point a browser which uses you squid proxy to some impossible domain name. The resulted error pages are amazingly beautiful! {{http://img261.imageshack.us/img261/4757/screenshoteroareurlulce.png}} You can go further and customize your pages in any way you want. Good luck! [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Http://img261.imageshack.us/img261/4757/screenshoteroareurlulce.png
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:Squid/Customize
。