修改: README.md 新文件: apache-config-second-header.md Signed-off-by: Xu, Shunxuan <sxxu@linx-info.com>
8.1 KiB
8.1 KiB
配置ftp服务器
配置二级域名(Apache域名服务器)
示例:
配置“172.16.0.234”的域名为“mirrors.rd.in.linx”
配置“172.16.0.234/TechnicalSupport-log/logs"的域名为”tslog.rd.in.linx“
安装apache服务包
注意apache2服务包要从debian源里下载安装。
可使用如下命令查找及安装:
aptitude search apache2
aptitude install apache2(可能也有别的服务依赖包,此处不做详述)
安装后,启动服务/etc/init.d/apache2 start
查看服务启动后的进程(主要查看服务运行的用户),示例如下:
root@mirrors:/etc/apache2# ps aux | grep apache
root 25188 2.3 0.7 171952 14272 ? Ss 13:51 0:00 /usr/sbin/apache2 -k start
www-data 25196 0.0 0.4 171952 8632 ? S 13:51 0:00 /usr/sbin/apache2 -k start
www-data 25197 0.0 0.4 171952 8632 ? S 13:51 0:00 /usr/sbin/apache2 -k start
www-data 25198 0.0 0.4 171952 8632 ? S 13:51 0:00 /usr/sbin/apache2 -k start
www-data 25199 0.0 0.4 171952 8632 ? S 13:51 0:00 /usr/sbin/apache2 -k start
www-data 25200 0.0 0.4 171952 8632 ? S 13:51 0:00 /usr/sbin/apache2 -k start
root 25202 0.0 0.0 7760 840 pts/1 S+ 13:51 0:00 grep apache
配置域名及二级域名
配置一级域名
修改apache配置文件/etc/apache2/sites-available/default,在<Directory /var/www/>的配置中添加一行”HeaderName footer.html“。(即当访问到此apache服务器时,会读取/var/www/footer.html配置文件)
配置文件如下:
root@mirrors:/etc/apache2/sites-enabled# cat /home/sxxu/apache2/sites-enabled/000-default
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
HeaderName footer.html
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
root@mirrors:/etc/apache2/sites-enabled#
添加的/var/www/footer.html配置文件如下:
root@mirrors:/etc/apache2/sites-enabled# cat /var/www/footer.html
<html>
<head>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="./github-markdown.css" type="text/css" />
<script Language="javascript">
var appPath="";
function checkUrl() {
var theurl;
var newurl="mirrors.rd.in.linx";
theurl=top.location.href;
if(theurl.indexOf("172.16.0.234",1)>=0){
self.location.href=theurl.replace('172.16.0.234','mirrors.rd.in.linx');
return;
}else if(theurl.indexOf("localhost",1)>=0){
alert('请通过http://'+newurl+' 访问本站.');
top.location.href='http://'+newurl;
}
}
window.onload = function(){checkUrl();}
</script>
<!--
//<script>
//try {
// if( self.location == "http://tslog.rd.in.linx/" ) {
// top.location.href = "http://mirrors.rd.in.linx/TechnicalSupport-log/logs";
// }
// } catch(e) {}
//</script>
-->
</head>
<body>
<h1>研发一部资料 <br></h1>
</body>
</html>
root@mirrors:/etc/apache2/sites-enabled#
配置二级域名
在上述配置完一级域名的基础上,配置二级域名示例。
修改apache2服务配置文件/etc/apache2/sites-available/default,添加二级域名的配置。配置如下:
<VirtualHost *:80>
ServerAdmin gdzhang@linx-info.com
DocumentRoot /var/www/tslog.rd.in.linx
ServerName tslog.rd.in.linx
HeaderName footer.html
ErrorLog ${APACHE_LOG_DIR}/tslog.rd.in.linx-error_log
CustomLog ${APACHE_LOG_DIR}/tslog.rd.in.linx-acess_log combined
</VirtualHost>
整个配置文件default示例如下:
root@mirrors:/etc/apache2/sites-available# cat default
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
HeaderName footer.html
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin gdzhang@linx-info.com
DocumentRoot /var/www/tslog.rd.in.linx
ServerName tslog.rd.in.linx
HeaderName footer.html
ErrorLog ${APACHE_LOG_DIR}/tslog.rd.in.linx-error_log
CustomLog ${APACHE_LOG_DIR}/tslog.rd.in.linx-acess_log combined
</VirtualHost>
在对应的目录/var/www/tslog.rd.in.linx下,添加配置文件footer.html(页面设置)。
示例文件如下:
root@mirrors:/var/www/tslog.rd.in.linx# cat footer.html
<html>
<head>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="./github-markdown.css" type="text/css" />
<script Language="javascript">
var appPath="";
function checkUrl() {
var theurl;
var newurl="tslog.rd.in.linx";
theurl=top.location.href;
if(theurl.indexOf("mirrors.rd.in.linx/TechnicalSupport-log/logs",1)>=0){
self.location.href=theurl.replace('mirrors.rd.in.linx/TechnicalSupport-log/logs','tslog.rd.in.linx');
return;
}else if(theurl.indexOf("localhost",1)>=0){
alert('请通过http://'+newurl+' 访问本站.');
top.location.href='http://'+newurl;
}
}
window.onload = function(){checkUrl();}
</script>
<!--
//<script>
//try {
// if( self.location == "http://tslog.rd.in.linx/" ) {
// top.location.href = "http://mirrors.rd.in.linx/TechnicalSupport-log/logs";
// }
// } catch(e) {}
//</script>
-->
</head>
<body>
<h1>研发一部信息收集记录 <br></h1>
<b>ftp上传下载使用方法 </b>
<b>:只能上传不能删除,如上传有误需删除请联系管理员 </b>
<pre>
linx6.0系统登录ftp服务器执行上传下载任务的方法:
(1)点击左面左上角的“位置”列表;
(2)在下拉菜单中选择“连接到服务器”(此时会出现一个连接到服务器的配置框);
(3)配置ftp服务器:
服务类型“FTP(需登录)”,服务器“tslog.rd.in.linx”,端口“21”,用户名“ts”
配置之后,点击“连接”,此时需要输入登录口令“rocky”
(4)登陆成功,自动打开tslog的文件浏览页面,或者通过桌面主文件夹中的网络类中的tslog目录访问;
(5)tslog的远程浏览页面中,可以在需要上传的位置直接粘贴文件(在本机复制需上传的信息记录等);
(6)如需下载,则可直接从tslog复制到本机即可。
</pre>
</body>
</html>
关于footer.html指定的设置页面格式的配置文件github-markdown.css,在这里不做记录,可到172.16.0.234的配置目录中(与footer.html同级)查找。
配置proftpd服务
注意配置/etc/proftpd.conf,创建目录/home/ts/logs
DefaultRoot ~/logs
...
<Directory /home/ts/logs>
<Limit DELE RMD>
DenyUser ts
</Limit>
</Directory>