File Template

Some File Template

Posted by JBNRZ on 2023-03-03
Estimated Reading Time 6 Minutes
Words 1k In Total
Viewed Times

Systemctl

/etc/systemd/system/XXXXX.service

1
2
3
4
5
6
7
8
9
10
11
[Unit]
Description=XXXXX

[Service]
Type=simple
User=root
ExecStart=[shell]
Restart=on-failure

[Install]
WantedBy=multi-user.target

systemctl daemon-reload

Apache2

1
2
3
4
a2enmod ssl
a2enmod rewrite
a2enmod proxy proxy_balancer proxy_http
systemctl restart apache2

/etc/apache2/ports.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 80
#Listen 8080
<IfModule ssl_module>
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

/etc/apache2/sites-enabled/000-default.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

ServerName jbnrz.com.cn
#启用 SSL 功能
SSLEngine on
#证书文件的路径
SSLCertificateFile /etc/httpd/ssl/jbnrz.com.cn.crt
#私钥文件的路径
SSLCertificateKeyFile /etc/httpd/ssl/jbnrz.com.cn.key
#证书链文件的路径
SSLCertificateChainFile /etc/httpd/ssl/root_bundle.crt

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/html">
# 新增
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</Directory>

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<VirtualHost *:443>

ServerName cloud.jbnrz.com.cn
#启用 SSL 功能
SSLEngine on
#证书文件的路径
SSLCertificateFile /etc/httpd/ssl/cloud/cloud.jbnrz.com.cn.crt
#私钥文件的路径
SSLCertificateKeyFile /etc/httpd/ssl/cloud/cloud.jbnrz.com.cn.key
#证书链文件的路径
SSLCertificateChainFile /etc/httpd/ssl/cloud/root_bundle.crt
#这里填代理服务器的IP或域名
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order deny,allow
Allow from all
# 新增
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</Directory>
AllowEncodedSlashes NoDecode
ProxyPass / http://127.0.0.1:5212/ nocanon
ProxyPassReverse / http://127.0.0.1:5212/

# RewriteEngine on
# RewriteCond %{HTTPS} !=on
# RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R]

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

pip.ini

1
2
3
4
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

apt

Ubuntu 20.04
/etc/apt/sources.list

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse

# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

Clash

/home/username/.config/clash/

1
2
3
config.yaml 从 windows 导出

Country.mmdb 从 https://github.com/esrrhs/pingtunnel/blob/master/GeoLite2-Country.mmdb 下载

Ubuntu vmware tools Install

1
2
3
4
5
6
换源

apt --purge remove open-vm-tools-desktop
apt --purge remove open-vm-tools

apt install open-vm-tools-desktop

frpc/frps

frpc.ini

1
2
3
4
5
6
7
8
9
10
11
[common]
tls_enable = true
server_addr = ip
server_port = 7000
token = token

[test web]
type = tcp
local_ip = 127.0.0.1
local_port = 80
remote_port = 80

frps.ini

1
2
3
4
5
6
7
8
9
[common]
bind_port = 7000
dashboard_addr = 0.0.0.0
dashboard_port = 1234
dashboard_user = user
dashboard_pwd = pwd
enable_prometheus = true
pprof_enable = true
token = token

Ping

1
2
关闭:echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all
开启:echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all

如果您喜欢此博客或发现它对您有用,则欢迎对此发表评论。 也欢迎您共享此博客,以便更多人可以参与。 如果博客中使用的图像侵犯了您的版权,请与作者联系以将其删除。 谢谢 !