question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Check nginx install without dpkg

See original GitHub issue

Summary

Regarding https://github.com/TryGhost/Ghost-CLI/blob/master/extensions/nginx/index.js#L282

    isSupported() {
        try {
            execa.shellSync('dpkg -l | grep nginx', {stdio: 'ignore'});
            return true;
        } catch (e) {
            return false;
        }
    }

We check Nginx by using a third-party command called dpkg that is available only on Debian-based distributions. I use Arch linux and I have nginx installed. I can check it with

    isSupported() {
        try {
            execa.shellSync('nginx -v', {stdio: 'ignore'});
            return true;
        } catch (e) {
            return false;
        }
    }

Then the command ghost setup nginx can do everything it needs:

/v/w/ghost> ghost setup nginx
✔ Creating nginx config file at /var/www/ghost/system/files/servername.conf
+ sudo ln -sf /var/www/ghost/system/files/servername.conf /etc/nginx/sites-available/servername.conf
+ sudo ln -sf /etc/nginx/sites-available/servername.conf /etc/nginx/sites-enabled/servername.conf
+ sudo nginx -s reload
✔ Setting up Nginx

Can we not consider using nginx -v to check for the presence of nginx?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
enguerrancommented, Oct 30, 2020

Thank you very much @acburdine for following up on this modification request which is clearly not proprietary but which I am very pleased with!

1reaction
acburdinecommented, Oct 9, 2020

@enguerran I’ve refactored the stack check to use systeminformation’s services utility to check if nginx is installed by iterating over the list of installed services, rather than distro-specific command like dpkg.

This change will be released with Ghost-CLI 1.15.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Install | NGINX
This page describes various ways to download and install NGINX.
Read more >
How To Install Nginx on Ubuntu 20.04 - DigitalOcean
Step 1 – Installing Nginx · Step 2 – Adjusting the Firewall · Step 3 – Checking your Web Server · Step 4...
Read more >
How to Install and Configure Nginx on Ubuntu 20.04
Step 1: Update Software Repositories · Step 2: Install Nginx From Ubuntu Repositories · Step 3: Verify the Installation · Step 4: Controlling...
Read more >
Install and configure Nginx - Ubuntu
Nginx (pronounced as “Engine-X”) is an open source web server that is often used as reverse proxy or HTTP cache. It is available...
Read more >
How To Find Out Nginx Version using command line - nixCraft
Check Nginx version command · See if Nginx is compiled with a particular module or not · What to do if I get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found