• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Changing Apache's Port for using Varnish Cache

ottomotto

New Pleskian
Hello,

I am quite astouned how hard it is to change a port number in Plesk for such a common scenario as using Varnish and/or Nginx in front of Apache.

My goal is to change the port of Apache to 8081 and let Varnish accept connections on port 80.

The official documentation tells that one have to hard-code port number by search-and-replace the variable within httpd-conf-template:

http://kb.parallels.com/en/114249
http://download1.parallels.com/Ples...nistration-guide/index.htm?fileName=68800.htm

This is ridiculous! Why would one do that if there is a variable? Where does the variable gets its data?
I found the answer here: http://www.codero.com/knowledge-base/questions/285/How+to+install+Varnish+on+Plesk+11
It basically tells to insert or replace a line in the table psa.misc (the line is not there after fresh installation, I assume 80 is hard-coded as the default port):

replace into psa.misc (param, val) values ("http_port", 8081);

After that we do:
/usr/local/psa/admin/sbin/httpdmng --reconfigure-all
/etc/init.d/apache2 restart

The produces the same result as following the official documentation and alter templates.

I have also changed /etc/apache2/ports.conf before starting apache to:

NameVirtualHost *:8081
Listen 8081

Now, when (re)starting Apache, the following warning appears twice:

[warn] NameVirtualHost *:8081 has no VirtualHosts

According to forum answers, the line "NameVirtualHost *:8081" appears somewhere else and causes this error. I could not find it however anywhere else. The warning disappears if the line is deleted/commented in /etc/apache2/ports.conf.

Still I am having the following problem:

Apache does not accept the vhost configuration! All domains on the IP address load the default Parallels landing page after changing port to 8081 (or any other number).

What am I missing? How to solve this problem?
 
Back
Top