mirror of
https://github.com/snail007/goproxy.git
synced 2026-04-27 00:15:51 +03:00
[GH-ISSUE #82] proxy centos 7 的开机自启命令 #45
Labels
No labels
TODO
bug
duplicate
enhancement
good first issue
help wanted
helpful
invalid
need-confirm
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/goproxy#45
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sealandwu on GitHub (May 20, 2018).
Original GitHub issue: https://github.com/snail007/goproxy/issues/82
说明
参考网络上其他人文章。
手动建立proxy.service服务文件
vi /etc/systemd/system/proxy.service
写入以下内容(端口及参数改成自己的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
@snail007 commented on GitHub (May 21, 2018):
cool
@sealandwu commented on GitHub (May 22, 2018):
如何需要升级,则执行:
systemctl stop proxy
升级脚本 (curl -L https://raw.githubusercontent.com/snail007/goproxy/master/install_auto.sh | bash
)
然后systemctl start proxy 即可!
@birdofprey commented on GitHub (May 24, 2018):
希望早日进入Debian Gnu/Linux大家庭。。。
@helllkz commented on GitHub (Mar 4, 2019):
ubuntu下面好像不行呢
centos7下面都没问题,但是ubuntu18.04下面会报错,Unknown section 'unit'. Ignoring
@eagleoflqj commented on GitHub (Jun 18, 2019):
Unit首字母大写
@ChanthMiao commented on GitHub (Aug 20, 2019):
建议将.service文件放入/lib/systemd/system目录,然后执行sudo systemctl daemon-reload&&sudo systemctl enable,这样会自动在/etc/systemd/system目录下生成符号链接.并且,这样还能方便地使用systemctl的enable和disable命令对goproxy进行管理.