Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the failure to start Varnish in Centos6

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to solve the failure of Varnish startup in Centos6. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Varnish is a high-performance Web accelerator, cache performance is very good, so I also learn such a good thing.

Seeing that the latest version of the official website is 4.0, I downloaded 4.0 without hesitation. On installation, the installation was very smooth, but it was not so lucky to use it.

Rpm-nosignature-I https://repo.varnish-cache.org/redhat/varnish-4.0.el6.rpm

Yum install varnish

Prepare to start varnish, but keep prompting failure

[root@localhost ~] # service varnish start

Starting Varnish Cache: [FAILED]

According to the tutorial on the official website, start it manually and everything is fine. The analysis concluded that there was something wrong with the startup script, so you first changed / etc/sysconfig/varnish to enable debug mode.

Add a-d to the end of the DAEMON_OPTS variable to start it in debug mode:

DAEMON_OPTS= "- a ${VARNISH_LISTEN_ADDRESS}: ${VARNISH_LISTEN_PORT}\-f ${VARNISH_VCL_CONF}\-T ${VARNISH_ADMIN_LISTEN_ADDRESS}: ${VARNISH_ADMIN_LISTEN_PORT}\-t ${VARNISH_TTL}\-p thread_pool_min=$ {VARNISH_MIN_THREADS}\-p thread_pool_max=$ {VARNISH_MAX_THREADS}\-p thread_pool_timeout=$ {VARNISH_THREAD_TIMEOUT}\ -u varnish-g varnish\-S ${VARNISH_SECRET_FILE}\-s ${VARNISH_STORAGE}-d "

Then start and find it stuck there all the time, change the start function in / etc/init.d/varnish, and start to get a prompt ("> / dev/null 2 > & 1" is to block any output information)

The code is as follows:

Daemon-- pidfile $pidfile $exec-P $pidfile "$DAEMON_OPTS" > / dev/null 2 > & 1

Finally got a hint.

[root@localhost ~] # service varnish startStarting Varnish Cache: Failed to change owner on. / vcl.qQKfF5iP.c: Operation not permittedRunning VCC-compiler failed, exited with 2 VCL compilation failed [FAILED]

It turns out that it is a permission problem. I think it may be a new version of bug 4.0. You can only change the startup users and groups to root (- u and-p). Use it first. Anyway, it's just for learning. If it is a production system, it is not recommended to start with root, because once there are vulnerabilities in varnish, such as remote overflow or command execution, it is directly root permission.

DAEMON_OPTS= "- a ${VARNISH_LISTEN_ADDRESS}: ${VARNISH_LISTEN_PORT}\-f ${VARNISH_VCL_CONF}\-T ${VARNISH_ADMIN_LISTEN_ADDRESS}: ${VARNISH_ADMIN_LISTEN_PORT}\-t ${VARNISH_TTL}\-p thread_pool_min=$ {VARNISH_MIN_THREADS}\-p thread_pool_max=$ {VARNISH_MAX_THREADS}\-p thread_pool_timeout=$ {VARNISH_THREAD_TIMEOUT}\ -u root-g root\-S ${VARNISH_SECRET_FILE}\-s ${VARNISH_STORAGE} "

Don't forget to remove the-d and start it successfully

The ultimate solution:

The root cause of the problem was later found because of Centos/Redhat 's Selinux problem (seemingly bug), see: https://bugzilla.redhat.com/show_bug.cgi?id=1125165

Just execute the following command to start Varnish correctly:

# setenforce 0

How to solve the failure of Varnish startup in Centos6 is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report