nginx troubleshooting - nginx: error while loading shared libraries:

nginx: error while loading shared libraries:

Geek Flare Blog post is sponsored by Netsparker Web Application Security Scanner.

I encountered the following error in Nginx.

./nginx: error while loading shared libraries: cannot open shared object file: No such file or directory

If you are getting above error while starting Nginx, you can fix by following.

This happens due to following three reasons.

  1. You don’t have PCRE installed
  2. Nginx was not compiled & installed using pcre
  3. PCRE library is not set in LD_LIBRARY_PATH

There are multiple ways to troubleshoot and fix this issue.

Let’s understand the error and fix it accordingly.

nginx: error while loading shared libraries:

Nginx is looking for a file which comes under PCRE library and usually installed on UNIX.

Let’s find using find command

$find / -name 

Ok, so I do have this file which means PCRE is already installed and will proceed with next troubleshooting step.

Note: If you don’t get find results then you got to install PCRE with the below command.

yum install pcre

If you don’t have root privilege, then you may ask the system administrator to install it.

Now, let’s set LD_LIBRARY_PATH as we could see is available under /usr/local/lib

$export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Start Nginx, it should be right now.

To learn more about Nginx, check out this course.

HostGator Hosting

2 thoughts on “nginx: error while loading shared libraries:”

Leave a Comment

Your email address will not be published. Required fields are marked *