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

nginx and ssl setup fails due to assuming presence of certain /etc/nginx directories #1821

Open
4 tasks done
20kaushik02 opened this issue Feb 28, 2024 · 4 comments
Open
4 tasks done

Comments

@20kaushik02
Copy link

20kaushik02 commented Feb 28, 2024

Summary

The nginx part of the setup process fails as the Ghost CLI relies on the presence of the /etc/nginx/sites-available folder and the SSL part fails due to the reliance on the presence of the /etc/nginx/snippets folder. I assume this reliance is because of how Ubuntu and some other package repositories maintain this convention in their version of nginx in their PPA.

The reliance can be seen here on /etc/nginx/sites-available and sites-enabled and here on /etc/nginx/snippets which throw errors

Reproduce by installing nginx from nginx.org for Ubuntu, or the corresponding distro's pre-built package. Even before running ghost setup or ghost install, you can see that the two folders do not exist. Ghost-CLI does not create these directories either, but assume their presence. This can be fixed by simply creating them with mkdir -p.

The underlying cause is that different package repositories distribute nginx with different configuration patterns. Some have a conf.d/*.conf pattern (official nginx.org release), some have the sites-available, sites-enabled pattern (older releases that follow this Apache-like style), some have neither and have only the default nginx.conf file (RHEL does this, and the core nginx source code has only this as well).

Both problems are solved simply by creating those directories before running ghost, so sudo mkdir -p /etc/nginx/sites-available /etc/nginx/sites-enabled /etc/nginx/snippets resolves this.

Steps to Reproduce

  1. Install any version of nginx distributed without the /etc/nginx/sites-available and /etc/nginx/snippets folder. For Ubuntu, follow these steps. Logs below are from nginx-1.24.0
  2. Run ghost install, or ghost install --no-setup followed by ghost setup

Log file

First, the nginx part:

ghost_server@instance-20240223-1343:~$ cat .ghost/logs/ghost-cli-debug-2024-02-28T20_04_38_506Z.log
Debug Information:
    OS: Ubuntu, v22.04.4 LTS
    Node Version: v18.19.1
    Ghost Version: 5.79.6
    Ghost-CLI Version: 1.25.3
    Environment: production
    Command: 'ghost setup'
Message: Command failed: /bin/sh -c sudo -S -p '#node-sudo-passwd#'  mv /tmp/blog-knravish-me/blog.knravish.me.conf /etc/nginx/sites-available/blog.knravish.me.conf
mv: cannot move '/tmp/blog-knravish-me/blog.knravish.me.conf' to '/etc/nginx/sites-available/blog.knravish.me.conf': No such file or directory


Exit code: 1

--------------- stderr ---------------
mv: cannot move '/tmp/blog-knravish-me/blog.knravish.me.conf' to '/etc/nginx/sites-available/blog.knravish.me.conf': No such file or directory

Then, the SSL part"

ghost_server@instance-20240223-1343:/var/www/blog.knravish.me$ cat ~/.ghost/logs/ghost-cli-debug-2024-02-28T20_11_24_271Z.log
Debug Information:
    OS: Ubuntu, v22.04.4 LTS
    Node Version: v18.19.1
    Ghost Version: 5.79.6
    Ghost-CLI Version: 1.25.3
    Environment: production
    Command: 'ghost setup'
Message: Command failed: /bin/sh -c sudo -S -p '#node-sudo-passwd#'  openssl dhparam -dsaparam -out /etc/nginx/snippets/dhparam.pem 2048
Can't open "/etc/nginx/snippets/dhparam.pem" for writing, No such file or directory
20F0B78BFFFF0000:error:80000002:system library:BIO_new_file:No such file or directory:../crypto/bio/bss_file.c:67:calling fopen(/etc/nginx/snippets/dhparam.pem, w)
20F0B78BFFFF0000:error:10000080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:75:


Exit code: 1

--------------- stderr ---------------
Can't open "/etc/nginx/snippets/dhparam.pem" for writing, No such file or directory
20F0B78BFFFF0000:error:80000002:system library:BIO_new_file:No such file or directory:../crypto/bio/bss_file.c:67:calling fopen(/etc/nginx/snippets/dhparam.pem, w)
20F0B78BFFFF0000:error:10000080:BIO routines:BIO_new_file:no such file:../crypto/bio/bss_file.c:75:

Technical details

This is automatically output by Ghost-CLI if an error occurs, please copy & paste:

  • OS: Ubuntu, v22.04.4 LTS
  • Node Version: v18.19.1
  • Ghost Version: 5.79.6
  • Ghost-CLI Version: 1.25.3
  • Environment: production
  • Command: 'ghost setup'

Bug submission checklist

Please fill out this checklist to acknowledge that you followed the requirements to submit a bug report.

  • Tried to find help in the forum & docs
  • Checked for existing issues
  • Attached log file
  • Provided technical details incl. operating system
@20kaushik02
Copy link
Author

I'll try to submit a simple PR for this if I can :)

@20kaushik02
Copy link
Author

Any maintainers in the house...?

Copy link

Our bot has automatically marked this issue as stale because there has not been any activity here in some time. The issue will be closed soon if there are no further updates, however we ask that you do not post comments to keep the issue open if you are not actively working on a PR. We keep the issue list minimal so we can keep focus on the most pressing issues. Closed issues can always be reopened if a new contributor is found. Thank you for understanding 🙂

@github-actions github-actions bot added the Stale label Aug 22, 2024
@20kaushik02
Copy link
Author

Still here, PR hasn't been seen either I guess...

@github-actions github-actions bot removed the Stale label Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant