Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Everytime v-update-letsencrypt-ssl runs it breaks snginx.conf #1291

Closed
DaniWinter opened this issue Oct 8, 2017 · 14 comments
Closed

Everytime v-update-letsencrypt-ssl runs it breaks snginx.conf #1291

DaniWinter opened this issue Oct 8, 2017 · 14 comments

Comments

@DaniWinter
Copy link
Contributor

@DaniWinter DaniWinter commented Oct 8, 2017

Operating System (OS/VERSION):

CentOS 7

VestaCP Version:

0.9.8 17

Installed Software (what you got with the installer):

All default

Steps to Reproduce:

run v-update-letsencrypt-ssl via terminal or cron.

Related Issues/Forum Threads:

Other Notes:

Everytime it runs and it has to update a certificate it breaks the snginx.conf file and nginx won't restart. It misses one ( server { ) opening everytime.

@noogen

This comment has been minimized.

Copy link
Contributor

@noogen noogen commented Nov 11, 2017

After reviewing the code here https://github.com/serghey-rodin/vesta/blob/master/func/domain.sh#L269

I would like to request for separate (nginx/apache/snginx/sapache) config for each domain under the same user.

Currently, the config file house multiple website in a single file. From my understand of the code above, it is using first and last line matching for parsing of the configuration file. This is too error prone and create many issue with bad config file even when user are not making any changes to the config file. Another example: https://forum.vestacp.com/viewtopic.php?f=11&t=14851

Also, what if user update the tpl or stpl file? This will cause problem with first and last line matching.

@dpeca

This comment has been minimized.

Copy link
Collaborator

@dpeca dpeca commented Nov 11, 2017

See #1248
This fix is already applied to all my production servers, I just wait here @serghey-rodin to accept or reject this solution.

@DaniWinter

This comment has been minimized.

Copy link
Contributor Author

@DaniWinter DaniWinter commented Nov 11, 2017

@dpeca, does the fix also have effect on the nginx config files? Those are the ones breaking for me.

@dpeca

This comment has been minimized.

Copy link
Collaborator

@dpeca dpeca commented Nov 11, 2017

No... this fix issue only with Apache conf :/
Do you alter your sginx.conf manually, by adding or removing lines ?

@DaniWinter

This comment has been minimized.

Copy link
Contributor Author

@DaniWinter DaniWinter commented Nov 11, 2017

@dpeca no that’s the weird thing, I’ve never touched it and it keeps on breaking after SSL renewal. It’s an easy fix because there is always 1 ‘server {’ line missing but it’s a bit annoying.

@dpeca

This comment has been minimized.

Copy link
Collaborator

@dpeca dpeca commented Nov 11, 2017

Can you compare size of nginx server block in that snginx.conf with size of server block in /usr/local/vesta/data/templates/web/nginx/ choosen stpl file ?
Maybe you need to add empty line before or after server { ... maybe it makes a difference in size block and because of that VestaCP makes a cut on wrong line...

@noogen

This comment has been minimized.

Copy link
Contributor

@noogen noogen commented Nov 11, 2017

This is why I am proposing separate conf for each website. Both nginx and apache2 (2.3.6 and later) support directory wildcard include: https://httpd.apache.org/docs/2.4/mod/core.html#include

include %home%/%user%/web/*/private/{apache2/nginx}.conf

Or you can individually reference each web/domain inside of apache2.conf or nginx.conf file as:

include %home%/%user%/web/%domain%/private/nginx.conf
@myrecs

This comment has been minimized.

Copy link

@myrecs myrecs commented Mar 2, 2018

have the same issue. nginx ssl conf was broken after cert renewal. is this problem already solved by someone?

@DaniWinter

This comment has been minimized.

Copy link
Contributor Author

@DaniWinter DaniWinter commented Mar 2, 2018

It is fixed in the latest version of Vesta, Vesta now saves nginx configs for each domain in a seperate file.

@myrecs

This comment has been minimized.

Copy link

@myrecs myrecs commented Mar 2, 2018

i have Version: 0.9.8 (amd64) | Release: 19
it's the latest

@DaniWinter

This comment has been minimized.

Copy link
Contributor Author

@DaniWinter DaniWinter commented Mar 2, 2018

Run v-rebuild-user USER to rebuild the user directory and create the new nginx configs.

@myrecs

This comment has been minimized.

Copy link

@myrecs myrecs commented Mar 2, 2018

should i? i already have "domain.nginx.ssl.conf" as working config and specifically this conf was broken

@xloading

This comment has been minimized.

Copy link

@xloading xloading commented Jul 16, 2018

Faced absolutely the same issue couple of days ago after updating Vesta to 0.9.8-22.
My nginx and apache configs were split by domains.
My hard times were doubled by the fact that Vesta backup for some reason does not back up domain-specific configs (domain.com.nginx.ssl.conf and domain.com.httpd.ssl.conf) and I had to restore them from scratch.

I have disabled v-update-letsencrypt-ssl Cron job but what to do further?
How can this issue be avoided further and how to make backup consider domain configs?

Had no such problems with 0.9.8-20 by the way.

@anton-reutov

This comment has been minimized.

Copy link
Collaborator

@anton-reutov anton-reutov commented Jul 28, 2018

@xloading what os and web stack on your server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.