[GH-ISSUE #82] proxy centos 7 的开机自启命令 #45

Open
opened 2026-02-27 23:15:11 +03:00 by kerem · 6 comments
Owner

Originally created by @sealandwu on GitHub (May 20, 2018).
Original GitHub issue: https://github.com/snail007/goproxy/issues/82

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

  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

Originally created by @sealandwu on GitHub (May 20, 2018). Original GitHub issue: https://github.com/snail007/goproxy/issues/82 说明 参考网络上其他人文章。 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
Author
Owner

@snail007 commented on GitHub (May 21, 2018):

cool

<!-- gh-comment-id:390597170 --> @snail007 commented on GitHub (May 21, 2018): cool
Author
Owner

@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 即可!

<!-- gh-comment-id:390997310 --> @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 即可!
Author
Owner

@birdofprey commented on GitHub (May 24, 2018):

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

<!-- gh-comment-id:391615538 --> @birdofprey commented on GitHub (May 24, 2018): 希望早日进入Debian Gnu/Linux大家庭。。。
Author
Owner

@helllkz commented on GitHub (Mar 4, 2019):

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

<!-- gh-comment-id:469087351 --> @helllkz commented on GitHub (Mar 4, 2019): ubuntu下面好像不行呢 centos7下面都没问题,但是ubuntu18.04下面会报错,Unknown section 'unit'. Ignoring
Author
Owner

@eagleoflqj commented on GitHub (Jun 18, 2019):

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

Unit首字母大写

<!-- gh-comment-id:502920195 --> @eagleoflqj commented on GitHub (Jun 18, 2019): > ubuntu下面好像不行呢 > centos7下面都没问题,但是ubuntu18.04下面会报错,Unknown section 'unit'. Ignoring Unit首字母大写
Author
Owner

@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进行管理.

<!-- gh-comment-id:523032417 --> @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进行管理.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/goproxy#45
No description provided.