0%

思路

blog:hexo
静态页面->nginx
部署:rsync

nginx

1
2
3
4
5
6
7
8
9
10
/etc/yum.repo/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

yum install nginx
cd /etc/nginx/sites-available
vi sample.com

导入站点配置内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
server{
listen 45.62.103.228:80 default_server;
root /var/www/fivelike.com/;
server_name fivelike.xyz;
access_log /var/log/nginx/fivelike_access.log;
error_log /var/log/nginx/fivelike_error.log;
location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
root /var/www/fivelike.xyz/;
access_log off;
expires 1d;
}
location ~* ^.+\.(css|js|txt|xml|swf|wav)$ {
root /var/www/fivelike.xyz/;
access_log off;
expires 10m;
}
location / {
root /var/www/fivelike.xyz;
if (-f $request_filename){
rewrite ^/(.*)$ /$1 break;
}
}
}

建立软链接

1
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

在/etc/nginx/nginx.conf http block:

1
include /etc/nginx/sites-enabled/*;

query port 80

1
2
3
4
lsof -i:80
firewall-cmd --add-port=80/tcp --zone=public --permanent
systemctl restart nginx.service
firewall-cmd --list-ports

rsync部署

1
rsync -arvp --delete-after -rsh="ssh" /home/fivelike/a/blog/public/ root@ xxx.xxx.xxx.xxx:/var/www/fivelike.xyz/

SSH配置文件

1
2
/etc/ssh/sshd_config  #修改VPS默认SSH端口
service sshd reload

pip install shadowsocks

1
2
3
4
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python get-pip.py
pip install shadowsocks
ssserver -p xxx -k xxx -m xxx

firewall-cmd开启ss端口

1
2
3
4
5
6
7
service firewalld start
firewall-cmd --add-port=xxx/tcp --zone=public --permanent
firewall-cmd --reload

#开机启动firewall
systemctl is-enabled firewalld.service
systemctl enable firewalld.service

脚本优化

1
2
3
4
5
6
7
8
#添加环境变量 /etc/profile export PATH="$PATH:/home/bin"
#runss sh
#!/usr/bin/sh
nohup ssserver -p xxx -k xxx -m xxx &
chmod +x runss

#开机执行
/etc/rc.d/rc.local /root/bin/runss

local sh

1
2
3
#!/usr/bin/sh
pkill sslocal
nohup sslocal -s xxx.xxx.xxx.xxx -p xxx -k xxxx -m xxx -l 1080 &

shell走代理

1
2
3
4
5
6
pcaman -S proxychains
/etc/proxychains.conf
ProxyList
socks5 127.0.0.1 1080
go!
proxychains4 pip install xxx