goproxy icon indicating copy to clipboard operation
goproxy copied to clipboard

proxy centos 7 的开机自启命令

Open sealandwu opened this issue 7 years ago • 6 comments

说明 参考网络上其他人文章。

  1. 手动建立proxy.service服务文件 vi /etc/systemd/system/proxy.service

  2. 写入以下内容(端口及参数改成自己的ExecStart=/usr/bin/proxy http -t tls -p ":8443" -C /etc/proxy/proxy.crt -K /etc/proxy/proxy.key)

[Unit] Description=proxy daemon After=syslog.target network.target Wants=network.target

[Service] Type=simple ExecStart=/usr/bin/proxy http -t tls -p ":8443" -C /etc/proxy/proxy.crt -K /etc/proxy/proxy.key Restart= always RestartSec=1min ExecStop=/usr/bin/killall proxy

[Install] WantedBy=multi-user.target

3. 开启服务

systemctl start proxy

4. 查看服务开启情况

systemctl status proxy

如果出现Proxy 界面则表示开启服务成功

5. 加入开机自启 systemctl enable proxy

sealandwu avatar May 20 '18 04:05 sealandwu

cool

snail007 avatar May 21 '18 09:05 snail007

如何需要升级,则执行: systemctl stop proxy 升级脚本 (curl -L https://raw.githubusercontent.com/snail007/goproxy/master/install_auto.sh | bash
) 然后systemctl start proxy 即可!

sealandwu avatar May 22 '18 13:05 sealandwu

希望早日进入Debian Gnu/Linux大家庭。。。

birdofprey avatar May 24 '18 07:05 birdofprey

ubuntu下面好像不行呢 centos7下面都没问题,但是ubuntu18.04下面会报错,Unknown section 'unit'. Ignoring

helllkz avatar Mar 04 '19 01:03 helllkz

ubuntu下面好像不行呢 centos7下面都没问题,但是ubuntu18.04下面会报错,Unknown section 'unit'. Ignoring

Unit首字母大写

eagleoflqj avatar Jun 18 '19 02:06 eagleoflqj

建议将.service文件放入/lib/systemd/system目录,然后执行sudo systemctl daemon-reload&&sudo systemctl enable,这样会自动在/etc/systemd/system目录下生成符号链接.并且,这样还能方便地使用systemctl的enable和disable命令对goproxy进行管理.

ChanthMiao avatar Aug 20 '19 14:08 ChanthMiao