Skip to content

Instantly share code, notes, and snippets.

@peter-y
peter-y / gist:1051f39ecc4971d45706c691251a5f6e
Created December 16, 2017 03:07
centos7 firewalld 使用记录
--permanent 不添加这个参数的的 都是临时操作,reload之后就没有了
firewalld 有zone的概念 一般最初是public
查看指定级别的所有信息,譬如 public
firewall-cmd --zone=public --list-all
已经被激活的zone信息
firewall-cmd --get-active-zones
查看运行状态
firewall-cmd --state
查看所有的被允许的级别(服务)
firewall-cmd --get-service
@peter-y
peter-y / gist:e8fcb138e9b6dc4d94af863a5bb84edf
Created December 16, 2017 03:10
http status code 简单说明
转载
作者:知乎用户
链接:https://www.zhihu.com/question/58686782/answer/159603453
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
最近正好使用了一会儿 Koa ,在这说一下自己对各个 请求码的见解和使用场景,懒人直接看 200、400、401、403、404、500 就可以了。
其中 2XX/3XX 其实都是请求成功,但是结果不同。
4XX 是请求出错,5XX 是服务器处理出现错误。
#多实例部署
下载tomcat 8.5.24
wget
tar zxvf tar.gz 解压
tomcat里面有两个环境变量 需要理解
CATALINA_HOME 和 CATALINA_BASE
在使用tomcat 多实例部署的时候,需要对tomcat本身的目录结构进行拆分,原装目录结构如下
./:
bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work
@peter-y
peter-y / xml
Last active September 28, 2021 06:39
PropertyPlaceholderConfigurer 配置 加载 properties 文件
<!-- 写法1 -->
<bean id="mappings"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<!-- typed as a java.util.Properties -->
<property name="properties">
<value>
jdbc.driver.className=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/mydb
</value>
@peter-y
peter-y / xml
Created December 16, 2017 06:57
父子bean的配置,并且 子bean 会marge 父类设置的同名属性进行合并,覆盖重复的,保留不同的
<beans>
<bean id="parent" abstract="true" class="example.ComplexObject">
<property name="adminEmails">
<props>
<prop key="administrator">administrator@example.com</prop>
<prop key="support">support@example.com</prop>
</props>
</property>
</bean>
<bean id="child" parent="parent">
@peter-y
peter-y / xml
Created December 16, 2017 07:00
p and c namespace
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="http://www.springframework.org/schema/c"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
</beans>
@peter-y
peter-y / logback.xml
Last active September 28, 2021 06:39
logback 多文件 #template
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="DEV_HOME" value="c:/logs" />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
</Pattern>
@peter-y
peter-y / .gitignore
Last active September 28, 2021 06:39
intellij idea gitignore file template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
@peter-y
peter-y / logback.xml
Created May 25, 2019 09:13
logback的模板
<?xml version="1.0" encoding="UTF-8"?>
<!-- ROOT 节点 -->
<!-- 属性描述 scan:性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。
debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件 输入位置,注意此处的/ -->
<property name="log_dir" value="logs"/>
<!-- 日志最大的历史 60天 -->
<property name="maxHistory" value="60"></property>
@peter-y
peter-y / logback.xml
Created May 25, 2019 09:39
logback 的配置模板
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="10 seconds">
<!-- Simple file output -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>