Page 1 of 1

What are the NGINX web templates for?

Posted: Sun Mar 18, 2018 12:38 pm
by Vengance
Hi,

I've been an apache user for a long time, but since VestaCP doesn't support PHP-FPM for Apache I think about moving to Nginx.
But I am confused by the different web templates, what's the reason behind them and why do some templates exist multiple times? Like "wordpress" and "wordpress2"


Thank you

Re: What are the NGINX web templates for?

Posted: Sun Mar 18, 2018 12:59 pm
by rhyker2u
NGINX uses web templates similar to Apache. The way VestaCP works is having pre-setup templates for certain environments. So you don't have to spend a lot of time coding the perfect webserver configuration from scratch (as some of us did back in the days prior to VestaCP).

The difference between wordpress and wordpress2? Great question. Used to know the answer too. :-D Wordpress2 is the one you should chose, as the other one doesn't work very well when you like permalinks to work. Thus the main difference is that wordpress.tpl doesn't have this:

Code: Select all

try_files $uri $uri/ /index.php?$args;
... next to some other minor things. However in your case (WP + NGINX) you might want to create a template of your own. Written a howto at viewtopic.php?f=11&t=13668 to save you from pioneering it all together and how to improve your server and WP security.

Re: What are the NGINX web templates for?

Posted: Sun Mar 18, 2018 1:05 pm
by Vengance
Thank you for your answer!
So I always have to change the web template according to the software I use?
With Apache I had one template which I could always use.

Re: What are the NGINX web templates for?

Posted: Sun Mar 18, 2018 1:21 pm
by rhyker2u
short answer: yes.

I didn't always do that though. I started with a default VestaCP template for anything (default, WP, Joomla, codeigniter, etc.) and then I used to adapt the domain vhost files in /home/admin/conf/web/ manually (as thats how I was accustomed to do things too on CentOS + Apache2 without VestaCP). The drawback of that approach is when VestaCP releases an update, the '/usr/local/vesta/bin/v-rebuild-user admin` is issued and you lose all customizations. Hence its better to create your own templates. However selecting wordpress2.tpl is a great starting point. Once you get the hang of things, you will never ever go back to using anything else than VestaCP (nor Apache2 for that matter, as NGINX-only webserver environments powering WordPress RULE; see my guide here on the forum).