admin 发布的文章

rc.local脚本是一个ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令。该脚本位于/etc/路径下,需要root权限才能修改。

该脚本具体格式如下:

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
#
touch /var/lock/subsys/local

exit 0

安装 gost

wget -N --no-check-certificate https://github.com/ginuerzh/gost/releases/download/v2.11.0/gost-linux-amd64-2.11.0.gz && gzip -d gost-linux-amd64-2.11.0.gz


mv gost-linux-amd64-2.11.0 gost

chmod +x gost

落地机:

./gost -D -L "ws://:8080?path=/ws&rbuf=4096&wbuf=4096&compression=false"

中转机

./gost -L=:本地端口/落地IP:落地端口 -F=ws://落地IP:8080/ws


查看服务器的DNS信息

查看/etc/resolv.con文件

[root@localhost ~]# cat /etc/resolv.conf 
nameserver 192.168.xxx.xxx
#search localdomain
[root@localhost ~]# 

修改服务器的DNS信息

修改DNS服务器非常简单,只需要修改/etc/resolv.conf配置文件即可。那么修改DNS是否需要重启某些服务,答案是不需要。修改后会立即生效,不需做任何额外处理

hosts文件是linux系统中负责ip地址与域名快速解析的文件,以ASCII格式保存在/etc目录下,文件名为hosts,

查看linux中的hosts文件

cat /etc/hosts
127.0.0.1 localhost
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.100 waptest



  1. 创建文件 app/helpers.php

<?php
// 示例函数
function foo() {
return "foo";

  1. 修改项目 composer.json

在项目 composer.json 中 autoload 部分里的 files 字段加入该文件即可:

"autoload": {
"files": [

  "app/helpers.php"

]

3,然后运行:

composer dumpautoload -o

4,OK,然后你就可以在任何地方用到 app/helpers.php 中的函数了。

自定义类库 创建文件app/Libraries/Test.php

<?php
namespace App\Libraries;

class Test{

public static function index(){
    echo 123;
}

  1. 修改项目 composer.json
    在项目 composer.json 中 autoload 部分里的 files 字段加入该文件即可:

"autoload": {

    "files" : [
        "app/helpers.php"
    ],
    "classmap": [
        "app/Libraries",
        "database/seeds",
        "database/factories"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},


composer dumpautoload -o

类使用

use App\Libraries\Test;
class IndexController extends Controller
{

public function ttt(){
    Test::index();
}

}

校准节点系统时间

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
yum install ntpdate
ntpdate -u time.nist.gov

国内常用NTP时间服务器

NTP服务器

ntp.aliyun.com             
ntp1.aliyun.com
ntp2.aliyun.com
ntp3.aliyun.com
ntp4.aliyun.com
ntp5.aliyun.com
ntp6.aliyun.com
ntp7.aliyun.com

#Time服务器
time1.aliyun.com
time2.aliyun.com
time3.aliyun.com
time4.aliyun.com
time5.aliyun.com
time6.aliyun.com
time7.aliyun.com