作者: ianzhi

  • Linux服务器的安全相关配置

    记录一下Linux服务器一般常用的安全相关配置,避免被简单的黑掉,更复杂的配置暂不考虑深入研究了。

    1. 添加用户、用户组

    # 添加用户组
    groupadd users
    # 添加用户
    useradd test
    # 将用户test添加到users组中
    usermod -g users test

    2. 启用密钥登陆

    # 1. 开启密钥登陆配置
    vim /etc/ssh/sshd_config
    
    # 将一下两个配置项打开
    RSAAuthentication yes
    PubkeyAuthentication yes
    
    # 2. 配置密钥
    # 生成密钥
    ssh-keygen
    # 复制公钥,放进服务器/home/xxx/.ssh/authorized_keys文件中
    vim /home/xxx/.ssh/authorized_keys
    
    # 3. 使用公钥测试连接
    ssh test@1.1.1.1
    
    # 4. 关闭密码登陆功能
    vim /etc/ssh/sshd_config
    
    # 禁止使用密码登陆
    PasswordAuthentication no
    # 禁止root账号登陆
    PermitRootLogin no
    # 指定SSH协议版本
    Protocol 2
    # 最大尝试次数
    MaxAuthTries 3
    
    # 重启ssh服务
    systemctl restart sshd
    
    # 5. 配置仅允许指定组使用su
    vi /etc/pam.d/su
    
    # 添加行
    auth required pam_wheel.so group=xxx
    
    # 6. 启用防火墙
    # Debian防火墙默认允许所有INPUT和OUTPUT,
    # 建议直接关闭所有流入,然后根据需要配置开放的端口,比如80,443,22等
    # 除了80与443,建议其他程序都更换默认端口,每增加一个策略就会增加部分安全性
    # !!!!禁止所有流量流入,注意放开SSH,否则就进不去了!!!!
    systemctl start nftables
    systemctl enable nftables

  • 网页、APP跳转应用商店

    安卓

    1. 跳转到应用页面:market://details?id=
    2. 跳转到搜索:market://search?q=

    IOS

    1. 应用页面:itms-apps://itunes.apple.com/app/id 114211089
  • PHP文件上传$_FILES无内容

    一般是以下两个参数的配置问题。

    upload_max_filesize='100M'
    post_max_size='100M'

  • WordPress/woocommerce性能优化

    默认安装的 WordPress 性能表现很一般,尤其如果添加了 woocommerce 插件后,后台总有一种卡顿的感觉,为了提升 WordPress/woocommerce 的使用体验,需要进行一些性能优化操作。WordPress 本身是一个基于 PHP 实现的程序,因此要优化使用体验就要在 LNMP/LAMP 架构的组件配置上进行调整。这篇文章介绍一些 LNMP 架构中,对于 WordPress 性能有影响的配置项,理论上应该也适用于其他 PHP 项目。

    (更多…)
  • 如何将网站权重提升到1

    在Google中,网站的权重(或者说“PageRank”)是一个页面的重要性的度量。它基于链接,也就是其他页面指向该页面的链接。当搜索引擎(比如Google)找到一个页面时,它会对该页面进行评估,并根据该页面的链接数量和质量来决定其权重。权重高的页面通常会在搜索结果中排名更高。

    (更多…)
  • WordPress常用插件

    WordPress提供了完善的插件机制,通过使用插件,我们可以优化Wordpress的性能、丰富Wordpress的功能,但是插件市场的插件实现也良莠不齐的,记录一些使用体验优秀的插件,主要推荐官方的插件。

    (更多…)
  • PHP中对象缓存方式的选择

    类似于Map的键值类型对象缓存对于提高应用的性能有很大的作用,实现此类缓存的方式也比较多,那么该如何选择对象缓存的方式呢?由于PHP常用的运行方式主要是基于FPM的形式,这篇文章暂不考虑常驻内存形式的缓存。

    (更多…)
  • MySQL给已存在的主键字段添加自增AUTO_INCREMENT

    每次都记不起来,记录一下…

    # 添加自增约束
    alter table table_name modify column COLUMN_NAME COLUMN_TYPE auto_increment;
    # 配置自增起始值
    alter table table_name auto_increment=10000;
  • How to calculate the similarity of two articles using PHP

    How to calculate the similarity of two articles using PHP?

    (更多…)
  • SEO如何优化网站标题

    网站标题是SEO优化中非常重要的一部分,以下是一些可以优化网站标题的建议:

    (更多…)
  • HTTP status and The meaning

    Here are some of the most common HTTP status codes and their meanings:

    (更多…)
  • 如何避免WordPress/Woocommerce网站被黑

    WordPress本身的安全性相对来说还是值得信任的,但是依然还是有一些缺点,那么如何避免Wordpress站点被黑呢?我们来看看纯净Wordpress站点存在的一些安全隐患吧。

    (更多…)
  • APP分发前的准备工作

    1. 登录、注册、注销
    2. 隐私权政策和服务协议
    3. 登录注册页面弹窗(勾选已读服务协议和隐私权政策,弹窗动作必须)
    4. 应用市场和对应账号
      • 苹果开发者会员
      • 主体认证
      • 涉及收费可能需要ICP证
    5. 软著登记证
  • How to improve wordpress performance


    There are a number of things you can do to improve the performance of your WordPress site:

    (更多…)
  • 使用typescript开发chrome扩展

    记录一下使用typescript开发chrome扩展的相关配置。

    1. 安装依赖

    必定需要用到的开发依赖项:

    • chrome-types
    • copy-webpack-plugin
    • ts-loader
    • typescript
    • webpack-cli
    npm install chrome-types webpack-cli ts-loader typescript copy-webpack-plugin --save-dev

    2. 打包配置

    2.1 首先创建ts配置文件

    npx tsc --init

    2.2 创建webpack打包配置文件

    const path = require('path');
    const CopyPlugin = require("copy-webpack-plugin");
    
    module.exports = {
      mode: 'production',
      entry: {
        index: {
          import: './src/index.ts',
          filename: 'index.js'
        },
        background: {
          import: './src/background.ts',
          filename: 'background.js'
        }
      },
      plugins: [
        new CopyPlugin({
          patterns: [
            { from: "public", to: "" },
          ],
        }),
      ],
      module: {
        rules: [
          {
            test: /.tsx?$/,
            use: 'ts-loader',
            exclude: /node_modules/,
          },
        ],
      },
      resolve: {
        extensions: ['.tsx', '.ts', '.js'],
      },
      output: {
        clean: true
      },
    };

    3. 配置打包命令

    "scripts": {
        "test": "echo "Error: no test specified" && exit 1",
        "build": "webpack build"
      }

    4. 基本目录结构截图

    chrome使用typescript目录结构
    chrome使用typescript目录结构
  • use multiple simple queries or a join

    The decision of whether to use multiple simple queries or a join depends on the specific requirements of the query.

    (更多…)
  • php: /usr/local/lib/libcurl.so.4: no version information available (required by php)

    出现原因是安装了多个版本的库,ubuntu的一些库似乎增加了一些附加补丁,导出的符号与ubuntu有关联的版本信息,但在标准的库中是没有的。

    (更多…)
  • how to improve the rank of search results in google

    There are many factors that affect a website’s ranking in Google search results, but some of the most important include:

    (更多…)
  • 为什么股市做空比做多危险

    做空和做多都是金融市场中的一种交易策略,但是它们的风险是不同的。以下是一些原因,说明为什么做空比做多危险:

    (更多…)
  • MySQL多层级树形结构表的搜索查询优化

    业务中有思维导图的功能,涉及到大量的树形结构搜索、查询相关的功能,使用场景上查询量远高于增删改操作,记录一下当前的解决方案。

    (更多…)