Solve the problem of configuring nginx in Ubuntu

Time:2021-6-14

Various errors in configuring nginx in Ubuntu 18.04

  1. lackPCRE Library

    Compiling nginx

    Solve the problem of configuring nginx in Ubuntu

An error occurred

Solve the problem of configuring nginx in Ubuntu

Error installing PCRE Library

Solve the problem of configuring nginx in Ubuntu

Manual compilation and installation of PCRE Library

(1) Download and unzip the PCRE library

wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar -xvf pcre-8.43.tar.gz

Solve the problem of configuring nginx in Ubuntu

(2) Compile and install PCRE Library

cd pcre-8.43
sudo ./configure
sudo make
sudo make install

Recompile nginx

#Under nginx-1.12.2
sudo ./configure --with-stream

Command executed successfully

Solve the problem of configuring nginx in Ubuntu

  1. “Struct crypt” appears_ Data “has no name” current “_ “Salt” member error

    Execute the make command

    sudo make && make install

    “Struct crypt” appears_ Data “has no name” current “_ “Salt” member error

    Solve the problem of configuring nginx in Ubuntu

Solution: enter the corresponding path and comment the 36th line of the source code

sudo vi src/os/unix/ngx_user.c

Solve the problem of configuring nginx in Ubuntu

Re execute the sudo make & make install command

  1. Error – werror = cast function type occurred

Solve the problem of configuring nginx in Ubuntu

Solution

#Enter the objs directory under nginx-1.12.2
cd objs
#Modify makefile file
sudo vi Makefile

Solve the problem of configuring nginx in Ubuntu

Go back to nginx-1.12.2 and execute sudo make & & make install

  1. Insufficient permission error in make command

    Solve the problem of configuring nginx in Ubuntu

Enter the root mode and execute the command

Sudo Su # enter root mode
make && make install
  1. Unable to connect when nginx startsPCRE Libraryerror

    Solve the problem of configuring nginx in Ubuntu

View dependency Library

Solve the problem of configuring nginx in Ubuntu

Go to the / usr / local / lib directory

Solve the problem of configuring nginx in Ubuntu

Set up soft connection

#Go back to the SBIN directory under nginx
cd /usr/local/nginx/sbin
#Set up soft connection
ln -s /usr/local/lib/libpcre.so.1.2.11 libpcre.so.1
#Set LD_ LIBRARY_ In this way, you need to reset LD every time you start nginx_ LIBRARY_ PATH)
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Restart nginx

./nginx
#Check whether the service starts normally
netstat -tanp

Solve the problem of configuring nginx in Ubuntu