ikhan05

Registered
May 26, 2016
4
0
51
Pakistan, Hyderabad
cPanel Access Level
Root Administrator
Hello,

I have installed varnish cache server 6 today, my current configuration is nGinx Front on port 80 and Apache behin on port 81 and ssl 444 as WHM default settings. but i want Varnish act as Front Cache so i change the port of nGinx server from this file /etc/nginx/conf.d/default.conf

port 80 to 82
ssl 443 to 445 as i want both http and https listen via varnish.

to

Code:
server {
    listen 82;
    listen [::]:82;

    # We want SSL for this server so http:// and https:// work the same for these server_name’s
    listen 445 ssl;
    listen [::]:445 ssl;
after this i change the Varnish configuration file to listen nGinx as this is in the middle between apache and varnish so i change the followin in

/etc/varnish/default.vcl

Code:
# Default backend definition. Set this to point to your content server.

backend default {

    .host = "127.0.0.1";

    .port = "82";

and in /lib/systemd/system/varnish.service

Code:
ExecStart=/usr/sbin/varnishd \
      -a :80 \
      -a :8443,PROXY \
      -p feature=+http2 \
      -f /etc/varnish/default.vcl \
      -s malloc,256m
ExecReload=/usr/sbin/varnishreload
with thin configuration APACHE AND VARNISH is UP and RUNNING but the nGinx is not start and it keep shows the 80 port bind error:

Code:
[[email protected] ~]# systemctl status nginx.service
● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2021-12-06 14:19:11 CET; 17s ago
     Docs: http://nginx.org/en/docs/
  Process: 22759 ExecStopPost=/bin/sh -c ps -C nginx -o pid,command= --no-headers | grep "nginx: logger process" | awk "{ print \$1 }" | xargs -r kill -9; ps -C splitlogs -o pid,command= --no-headers | grep "nginx/domains" | awk "{ print \$1 }" | xargs -r kill -9 (code=exited, status=0/SUCCESS)
  Process: 22757 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
 Main PID: 18574 (code=exited, status=0/SUCCESS)

Dec 06 14:19:09 server.xxxx.xx nginx[22757]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec 06 14:19:10 server.xxxx.xx nginx[22757]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec 06 14:19:10 server.xxxx.xx nginx[22757]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec 06 14:19:10 server.xxxx.xx nginx[22757]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Dec 06 14:19:10 server.xxxx.xx nginx[22757]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Dec 06 14:19:11 server.xxxx.xx nginx[22757]: nginx: [emerg] still could not bind()
Dec 06 14:19:11 server.xxxx.xx systemd[1]: nginx.service: control process exited, code=exited status=1
Dec 06 14:19:11 server.xxxx.xx systemd[1]: Failed to start nginx - high performance web server.
Dec 06 14:19:11 server.xxxx.xx systemd[1]: Unit nginx.service entered failed state.
Dec 06 14:19:11 server.xxxx.xx systemd[1]: nginx.service failed.
as i already updated the port in the nginx configuration file at /etc/nginx/conf.d/default.conf but it still not listening this, is there any other file i have to update ? as i believe whm/cpanel generate its own configuration ? any help would be appreciated.

Thanks
 

cPanelAnthony

Administrator
Staff member
Oct 18, 2021
1,045
112
118
Houston, TX
cPanel Access Level
Root Administrator
Hello! While we do not support the configuration of Varnish, the following article helps explain where our nginx configurations would be. I hope this helps.

 

ikhan05

Registered
May 26, 2016
4
0
51
Pakistan, Hyderabad
cPanel Access Level
Root Administrator
Hello Anthony,

I m not asking varnish support, i am here to ask you to which file is nGinx listen ? because the file is mention on your provided article already modified to listen on port 82 but it wont listen 82 port in this file /etc/nginx/conf.d/default.conf