• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff here.

Nginx reactivation fails

SigmundS

Basic Pleskian
Hello everybody,
first some details, I'm using Parallels Plesk Panel 11.0.9 and Ubuntu 12.04. All is up to date (as far as I can see).
What did I do? I tried to uninstall nginx.
How did I do it? I deactivated nginx in the Panel (Tools & Settings > Services management). Then I tried to uninstall it via Ubuntu (putty console, root account).
What happend next? I looked into the Ubuntu files to see if there is something left of nginx (find / -name 'nginx') and found every single file that should have been deleted by the uninstall process. Because I ran out of time, I left it this way for 2 days (because everything worked because apache2 kicked in as it should).
In the mean time, I talked to a friend who spoke very fond of the nginx server, so I decided to give it another chance and activate it again (because the files where still there, exept for the "/etc/logrotate.d/nginx" and the "/var/log/nginx").
I got an error msg in Plesk:
New files of configuration for Apache web server were not built due to errors in configuration templates: /opt/psa/admin/sbin/nginx-config: line 221: /usr/sbin/nginx: No such file or directory . The detailed error message was e-mailed to you, so please check the e-mail, fix the errors, and click here to retry generating broken configuration or click here to retry generating of all configurations.
I tried to klick both "here" but neither worked.
Since then I tried to remove or reinstall the nginx server again but with no success.

How can I remove it from within the Plesk panel and reinstall it again so it works again? If you need more info, just let me know.

Thx 4 F1.

s.h.
 
You can install/remove components in Plesk 11.5.

It's nice seeing that at least somebody tries to describe in detail what they did before encountering a problem. But you missed some important things. How exactly did you uninstall nginx (exact commands in shell would be nice)? Did you try to reinstall nginx before activating it?

Apparently you don't have nginx binary, so I assume you don't have sw-nginx package installed. If you actually do have sw-nginx package, remove it via # apt-get remove sw-nginx first. Then you should install nginx reverse proxy server support via Autoinstaller. And only then you should attempt to enable/start it again.
 
Hi Nikolay
thanks for the info. I didn't know there was a package called sw-nginx. But let's start from the begining:
First: Thx for your kind words.
It's nice seeing that at least somebody tries to describe in detail what they did before encountering a problem.
The more info, the bigger the chance to find somebody who knows a solution.

But you missed some important things.
Yes, I know. I try not to write too much, I found out that it scares people off ;).
But if somebody asks, I'll hand out the info they need :).

How exactly did you uninstall nginx (exact commands in shell would be nice)?
I stopped the service within plesk (Tools & Settings > Services management) but couldn't find a way to uninstall it with the panels tools. So I looked for a guide and found one, it said to stop the service again with "/usr/sbin/nginx -s stop" and then remove it with "sudo apt-get remove nginx". I think neither really worked.
So I had another look for another guide. I found one. It had the first two steps as well, so I thought it might be ok to try the next step "sudo rm -f -R /usr/local/nginx && rm -f /usr/local/sbin/nginx". And this is what ****ed things up I think. After that, I left it. I don't know exactly if I looked for the left nginx files before or after I came back, but thats what I did anyway.
Because files where still there, and my friend said I should give it another chance, I tried to start nginx. First with the console "/usr/sbin/nginx -s start".
But I don't think that did anything. So I tried the panel and got that error msg you can read in the first post.
When this didn't work either but the panel but the nginx "in place" and nothing worked, I paniced. Just a little bit ;).
(At this point I had the feeling that there was more than one nginx installed, and I removed the wrong one, or the right one and reinstalled the wrong nginx, I don't know, sorry, the server is preinstalled Ubuntu 12.04 and Plesk 11.0.9, it might be an nginx in both)
I tried to reinstall nginx (apt-get -f install nginx), but the "apt-get dist-upgrade" produced and error because of nginx not beeing installed correctly. Now I paniced a lot.
I found out, that there are more than one nginx packages. nginx, nginx-common, nginx-light and nginx-full. I installed the full package (apt-get -f install nginx-full) which got me rid of the error in apt-get but didn't get nginx back to work properly. I tried to start and stop it randomly with the panel and the console and made things worse I supose.
I gave it up and decided to ask someone who knows this stuff. And I wrote this post.


I know there are some inconsitencys with the folders where nginx should be, but this is what I did. I'm a complete linux noob, but I am neither afraid of failing nor of learning ;).

I don't use the guide 100% it tells, e.g.: the guide said command "/usr/bin/nginx etc" folder so I changed it to "/usr/sbin/nginx etc" because this is where I found the files. Btw, this is what I get when I do "find / -name 'nginx'"

/etc/init.d/nginx
/etc/default/nginx
/etc/nginx
/etc/logrotate.d/nginx
/var/lib/update-rc.d/nginx
/var/lib/nginx
/var/log/nginx


I didn't try your solution yet, because I wanted to wait if you have anything to say about the way I did what I did. And if it changes a possible solution.

Thx 4 F1.

s.h.
 
Last edited:
I am neither afraid of failing nor of learning ;)

That is very good.


OK, I see. Here's what you should do now.

1) Make apt packages state consistent via:
# apt-get -f install
I expect it to do nothing in your case since you said "which got me rid of the error in apt-get". Be careful here - this should not uninstall any of the Plesk packages (usually start with plesk-, psa-, or sw-).

2) Remove any foreign nginx packages, as well as properly remove Plesk package if it's still in the system:
# apt-get purge '^(sw-)?nginx.*$'

3) Go to Autoinstaller and install "Nginx reverse proxy support".

4) You can check that proper nginx package is installed via

# dpkg -l sw-nginx
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-====================================-====================================-========================================================================================
ii sw-nginx 1.5.0-1.13060711.debian60 High performance web and reverse proxy server


You may have lower version, it is OK too.

5) Now go to Panel, Services Management and start nginx service. This will enable and start it. Alternatively you can do the same from shell via:
# /usr/local/psa/admin/sbin/nginxmng -e

And that is all!


And here are some advices and notes (regarding Plesk and nginx usage in particular) for the future.

1) Don't do such things:
# /usr/sbin/nginx -s stop
Instead you should normally use service control scripts, or even better 'service' tool:
# service nginx stop
In Plesk context, though, it is even better to manage services normally managed by Plesk via Plesk tools. E.g.:
# /usr/local/psa/bin/service --restart nginx
That way you would avoid potential "hiccups". For example, Plesk automatically adjusts a couple of nginx parameters that normally should be managed manually. And if these parameters are not adjusted properly, nginx may fail to start.

2) Don't do such things either:
# rm -f -R /usr/local/nginx && rm -f /usr/local/sbin/nginx
This will basically turn your system in a mess (at least from a point of view of package manager). Instead you should use package manager to install/remove software.

3) Dist-upgrade ("apt-get dist-upgrade") is not officially supported by Plesk. While it may work, you may encounter unexpected problems. A common advice in this case is to use migration to switch to another OS version.

4) Plesk components removal is supported starting with Plesk 11.5 via Autoinstaller.
 
Thanks Nikolay,
the "apt-get -f install" got me this:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.2.0-32 linux-headers-3.2.0-32-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Looks good to me, I left "linux-headers-3.2.0-32 linux-headers-3.2.0-32-generic" as it is.

I didn't do step 2 because I have some more questions before I try this.
You said to use Autoinstaller. Where do I find it?
I use Plesk Panel 11.0.9. When I go to "Tools & Settings > Updates and Upgrades" The Parallels Installer opens, "Install or Upgrade Product" is greyed out as well as the "Update components" button, only the "Add components" button is available. Under "Updates source and installation settings" I can't set anything besides the "Store installation files in directory" and language.
If it has something to do with the licence, I could look for another one. If it's got to do with the Version, how can I update to Plesk 11.5 without breaking something? (Linux is Ubuntu 12.04 which is supported by Plesk 11.5)

In the "don't do such stupid things" part, you mentioned "apt-get dist-upgrade". I use that with cron-apt to keep the system up to date. What update string should I use instead? I used that on 2 servers now and never had a problem, but maybe I was just lucky.

Thx 4 F1.

s.h.
 
Last edited:
Thanks Nikolay,
the "apt-get -f install" got me this:

Looks good to me, I left "linux-headers-3.2.0-32 linux-headers-3.2.0-32-generic" as it is.

Yes, it's OK.

I didn't do step 2 because I have some more questions before I try this.
You said to use Autoinstaller. Where do I find it?
I use Plesk Panel 11.0.9. When I go to "Tools & Settings > Updates and Upgrades" The Parallels Installer opens, "Install or Upgrade Product" is greyed out as well as the "Update components" button, only the "Add components" button is available. Under "Updates source and installation settings" I can't set anything besides the "Store installation files in directory" and language.

Autoinstaller and Parallels Installer are different names for one thing. Just click on the "Add components" and select nginx component there as I described above. Alternatively you can use it from shell. Either just run /usr/local/psa/admin/sbin/autoinstaller and use console interactive interface, or use following command to install nginx non-interactively from shell (both require root privileges, obviously):

# /usr/local/psa/admin/sbin/autoinstaller --select-release-current --install-component nginx

If it has something to do with the licence, I could look for another one. If it's got to do with the Version, how can I update to Plesk 11.5 without breaking something? (Linux is Ubuntu 12.04 which is supported by Plesk 11.5)

You don't need to install Plesk 11.5 to solve your issue, but if you want to, you need to switch to 'early adopters' release tier in Panel Updates & Upgrades settings. Only then you will be able to see 11.5 release in Parallels Installer.

In the "don't do such stupid things" part, you mentioned "apt-get dist-upgrade". I use that with cron-apt to keep the system up to date. What update string should I use instead? I used that on 2 servers now and never had a problem, but maybe I was just lucky.

These things are not stupid per se, they are just dangerous if you don't fully understand what they do and potential consequences.

About dist-upgarde - I meant that you may have issues if doing dist-upgrade to change OS version (e.g., to upgrade from Ubuntu 12.04 to 13.04). apt-get upgrade is much safer to do in automated way (e.g., from cron), since it will not remove already installed packages.
 
Hi Nikolay,
IT WORKED. As you may have guessed ;). nginx is up and running again, and the nginx package is properly installed ("dpkg -l sw-nginx" looked like the one you posted) .

I will set the Plesk Update to "Early adopter release" later this week. At the moment I'm just happy, that it workes again without error msgs. If I do so, does it install 11.5 automatically? Update is set to "Automatically install updates for the currently installed version" anyway.

I changed the cron update job to "upgrade" only.

Thank you very much. I hope this detailed threat helps some else with this problem.

s.h.
 
I will set the Plesk Update to "Early adopter release" later this week. At the moment I'm just happy, that it workes again without error msgs. If I do so, does it install 11.5 automatically? Update is set to "Automatically install updates for the currently installed version" anyway.

Then you should receive notifications about new release and it would be visible in Parallels Installer, but you will need to upgrade to it manually.

Thank you very much. I hope this detailed threat helps some else with this problem.

So do I :)
 
Back
Top