+1 vote
in Web & Google by (10.2k points)
I am using MyVestaCP control panel on my server, which provides separate NGINX configuration file for each domain hosted on the server. However, MyVestaCP does not add IPv6 by default. So, I manually updated those configuration files to add IPv6. The issue is whenever NGINX server is updated, I lose those manual changes from the configuration file. Is these any way to make those changes permanent?

1 Answer

+2 votes
by (355k points)
selected by
 
Best answer

When you add a domain to the MyVestaCP control panel, you select a Proxy Template for the domain. By default, the Proxy Template is 'hosting'. If you want to permanently keep your changes in the NGINX configuration file for a domain, you need to modify the template files for your selected Proxy Template. Those template files can be found inside the folder:

/usr/local/vesta/data/templates/web/nginx

Suppose you want to add IPv6 to the NGINX configuration files; you will have to modify two template files: hosting.stpl (for *.nginx.ssl.conf) and hosting.tpl (for *.nginx.conf).

Open hosting.tpl in an editor and make the following change for IPv6.

listen      [your_ipv6]:%proxy_port%;

Open hosting.stpl in an editor and make the following change for IPv6.

listen     [your_ipv6]:%proxy_ssl_port% ssl;

After these changes in the template files, your configuration will always have an entry for IPv6. So, whenever the NGINX server is updated, you do not have to manually update domain-specific configuration files.

by (60.1k points)
Instead of making changes to the template files that came with the MyVestaCP installation, I would recommend making a copy of those template files and apply your changes to those new files. It is possible that update of MyVestaCP can delete your changes from those template files. So, creating your own template files is a safe bet.

...