[英]Why would varnish.service suddenly change its port? (From 80 to 6081)
I have a WordPress site with gunicorn and varnish running on an AWS instance.我有一个 WordPress 站点,在 AWS 实例上运行 gunicorn 和 varnish。
This morning, the website gave a "502 Bad Gateway nginx" error.今天早上,网站报了一个“502 Bad Gateway nginx”的错误。
Upon investigation, it looks like the varnish.service
port was:经过调查,看起来varnish.service
端口是:
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a:6081 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
According to some notes, the port needs to be 80
and not 6081
.根据一些注释,端口需要是80
而不是6081
。 Changing the port to 80
fixed the nginx error.将端口更改为80
修复了 nginx 错误。
This issue seems to happen about once a year where the varnish.service
port suddenly changes by itself and someone has to manually change the port back to 80
.这个问题似乎每年发生一次, varnish.service
端口突然自行更改,有人必须手动将端口更改回80
。
So my question is - why would varnish.service
suddenly change its port?所以我的问题是 - 为什么varnish.service
会突然改变它的端口? As far as I know, there were no updates or changes anywhere.据我所知,任何地方都没有更新或更改。
It depends on what file you're editing.这取决于您正在编辑的文件。
Make sure you're editing /etc/systemd/system/varnish.service
.确保您正在编辑/etc/systemd/system/varnish.service
。 If that file isn't there, just run the following command:如果该文件不存在,只需运行以下命令:
sudo cp /lib/systemd/system/varnish.service /etc/systemd/system/
When you're done editing the port, just run the following 2 commands:完成端口编辑后,只需运行以下 2 个命令:
sudo systemctl daemon-reload
sudo systemctl restart
See https://www.varnish-software.com/developers/tutorials/installing-varnish-ubuntu/#systemd-configuration for a detailed tutorial.有关详细教程,请参阅https://www.varnish-software.com/developers/tutorials/installing-varnish-ubuntu/#systemd-configuration 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.