1 개요[편집]

우분투16 바니시 80 포트 사용
  • 기존에는 /etc/default/varnish를 수정하면 포트 변경이 가능했는데, 우분투 16에서는 무시된다...

2 문제상황[편집]

root@zetawiki:~# cat /etc/default/varnish
START=yes
NFILES=131072
MEMLOCK=82000
DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,256m"
root@zetawiki:~# /etc/init.d/varnish restart
[ ok ] Restarting varnish (via systemctl): varnish.service.
root@zetawiki:~# netstat -tnlp | grep varnishd
tcp        0      0 0.0.0.0:6081            0.0.0.0:*               LISTEN      5856/varnishd   
tcp        0      0 127.0.0.1:6082          0.0.0.0:*               LISTEN      5856/varnishd   
tcp6       0      0 :::6081                 :::*                    LISTEN      5856/varnishd
→ 80 포트를 LISTEN하도록 했음에도 6081 포트를 LISTEN함
root@zetawiki:~# ps -ef | grep varnishd
vcache    5856     1  0 10:16 ?        00:00:00 /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
vcache    5886  5856  0 10:16 ?        00:00:00 /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
root      6121  2984  0 10:18 pts/0    00:00:00 grep --color=auto varnishd
→ 80포트가 아닌 -a :6081으로 되어 있음

3 방법[편집]

root@zetawiki:~# systemctl edit varnish.service
[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
root@zetawiki:~# cat /etc/systemd/system/varnish.service.d/override.conf 
[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
root@zetawiki:~# systemctl daemon-reload
root@zetawiki:~# /etc/init.d/varnish restart
[ ok ] Restarting varnish (via systemctl): varnish.service.
root@zetawiki:~# ps -ef | grep varnishd
vcache   18465     1  0 11:00 ?        00:00:00 /usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
vcache   18497 18465  0 11:00 ?        00:00:00 /usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
root     18715  4005  0 11:00 pts/1    00:00:00 grep --color=auto varnishd

4 참고 자료[편집]