4 月 262017
 

版本控制

适用于linuxcache.com网站系统的版本控制方案
版本号的命名方式和说明:
方案一:LINUXCACHE.COM 1.0.0(r2055)

主版本号:架构设计和界面改版变化(1-)
次版本号:功能新增或剔除(0-)
修订号:新增,变更,修复,优化(0-)
SVN修订号:发布打包的SVN修订号

方案二:LINUXCACHE.COM 16.7.0(r2055)

主版本号:年份(16-)
次版本号:月份(1-12)
修订号:新增,变更,修复,优化(0-)
SVN修订号:发布打包的SVN修订号
方案一按照明确的更新规模定义反映出版本更新频率,若长时间无主/次版本号变更需求,则主/次版本号使用意义较小。
方案二按照时间(年份,月份)来更直观的反映出版本更新频率,除主版本号每年变更外,其他部分变更较为频繁。
版本号中的SVN修订号部分,按照实际打包和发布新版本时所检出代码的SVN修订号。
基本流程:

1,在确认打包检出代码前,由开发人员确认并提交新增,变更,修复,优化内容的描述及其对应的SVN修订号。

2,检出代码准备打包,确认最终SVN修订号,由打包发布人员告知其他开发人员,做最终确认(避免遗漏,误提交)。

3,发布内容,变更版本号及对应SVN修订号,发布后的通知邮件应包含第一步中的信息,及完整的版本号信息。

4,由运维记录和汇总版本变化信息,跟踪和确认所有版本变更和发布操作。

4 月 242017
 

vsftpd使用系统用户及被动模式配置

anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
pasv_max_port=40100
pasv_min_port=40200

iptables -I INPUT -p tcp –dport 21 -j ACCEPT
iptables -I INPUT -p tcp –dport 40100:40200 -j ACCEPT
useradd tom -s /sbin/nologin
passwd tom

# chkconfig –level 35 vsftpd on
# chkconfig –list vsftpd
vsftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
#

3 月 252017
 

Tomcat及Java配置并使用http proxy的方法

系统全局代理

export https_proxy=http://172.191.1.64:3128
export http_proxy=http://172.191.1.64:3128

在bin/catalina.sh增加配置

JAVA_OPTS="-Dhttp.proxyHost=172.191.1.64 -Dhttp.proxyPort=3128 \
-Dhttps.proxyHost=172.191.1.64 -Dhttps.proxyPort=3128 \
-Dhttp.nonProxyHosts='localhost|appserver1|127.*|10.*|100.*'"

在conf/catalina.properties增加配置
在/usr/java/jdk1.7.0_80/jre/lib/net.properties增加配置

http.proxyHost=172.191.1.64
http.proxyPort=3128
https.proxyHost=172.191.1.64
https.proxyPort=3128
http.nonProxyHosts=localhost|appserver1|127.*|10.*|100.*

在代码中指定连接代理配置

https://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html
http://memorynotfound.com/configure-http-proxy-settings-java/
2 月 242017
 

过滤Tomcat日志文件catalina.out中的启动记录

# grep 'org.apache.catalina.startup.Catalina start' /data/tomcat/logs/catalina.out |less
Jan 16, 2017 10:57:49 PM org.apache.catalina.startup.Catalina start
Jan 17, 2017 11:17:17 AM org.apache.catalina.startup.Catalina start
Jan 17, 2017 7:08:31 PM org.apache.catalina.startup.Catalina start
Jan 18, 2017 10:39:09 AM org.apache.catalina.startup.Catalina start
Jan 18, 2017 3:54:37 PM org.apache.catalina.startup.Catalina start
Jan 18, 2017 7:54:06 PM org.apache.catalina.startup.Catalina start
Jan 20, 2017 2:39:36 PM org.apache.catalina.startup.Catalina start
Jan 20, 2017 7:57:22 PM org.apache.catalina.startup.Catalina start
Jan 22, 2017 2:07:31 PM org.apache.catalina.startup.Catalina start
Jan 22, 2017 4:18:44 PM org.apache.catalina.startup.Catalina start
Jan 24, 2017 4:05:56 PM org.apache.catalina.startup.Catalina start
Jan 24, 2017 6:00:29 PM org.apache.catalina.startup.Catalina start
Feb 07, 2017 10:16:15 AM org.apache.catalina.startup.Catalina start
Feb 09, 2017 6:42:21 PM org.apache.catalina.startup.Catalina start
Feb 10, 2017 9:24:40 AM org.apache.catalina.startup.Catalina start
Feb 21, 2017 2:18:17 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 3:48:38 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 3:52:05 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 4:44:43 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 4:50:22 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 4:57:02 PM org.apache.catalina.startup.Catalina start
Feb 21, 2017 6:37:05 PM org.apache.catalina.startup.Catalina start
Feb 23, 2017 3:33:05 PM org.apache.catalina.startup.Catalina start

每日处理日志并将前一日结果写入文件

grep 'org.apache.catalina.startup.Catalina start' /data/tomcat/logs/catalina.out |\
grep "`date -d yesterday +%b\ %d\,\ %Y`" > tomcat.`date -d last-day +%Y%m%d`.txt;
2 月 222017
 

IP伪装开关

firewall-cmd --query-masquerade
firewall-cmd --add-masquerade
firewall-cmd --remove-masquerade

端口转发规则
firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
firewall-cmd --add-forward-port=port=80:proto=tcp:toaddr=192.168.2.100
firewall-cmd --add-forward-port=port=80:proto=tcp:toaddr=192.168.2.100:toport=8080
2 月 102017
 

#
# Content of this file, with correct values, can be automatically added to
# your Apache server by using the AWStats configure.pl tool.
#


# If using Windows and Perl ActiveStat, this is to enable Perl script as CGI.
#ScriptInterpreterSource registry


#
# Directives to add to your Apache conf file to allow use of AWStats as a CGI.
# Note that path "/usr/share/awstats/" must reflect your AWStats install path.
#
Alias /awstatsclasses "/usr/share/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/share/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/share/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/share/awstats/wwwroot/cgi-bin/"


#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/usr/share/awstats/wwwroot">
 Options None
 AllowOverride None
 <IfModule mod_authz_core.c>
 # Apache 2.4
 Require local
 </IfModule>
 <IfModule !mod_authz_core.c>
 # Apache 2.2
 Order allow,deny
 Allow from 127.0.0.1
 Allow from ::1
 </IfModule>
</Directory>
# Additional Perl modules
<IfModule mod_env.c>
 SetEnv PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
</IfModule>