Solution for Nginx installation without generating sbin directory

Solution for Nginx installation without generating sbin directory

Error description:

1. After installing Nginx (1.18.0) on Linux (CentOS 7 64) system, the sbin startup directory cannot be found.


2. Use nginx -v to check the version prompt command not found

Problem 1: No sbin directory is generated

Tried the following solutions without success:

Method 1: Download version 1.19 and reinstall it. I tried to install 1.19, but there is still no sbin directory.


Method 2: A method found on the Internet:

Find the file that reports an error, in the unzipped nginx file src/os/unix/ngx_user.c , use the vi command to edit it, comment the error, save and exit; then go to the objs folder of the unzipped directory, edit the Makefile file, and delete -Werror


But I didn't find any error message in ngx_user.c , then I deleted -Werror in Makefile and recompiled, but the sbin directory was not generated.

Problem 2: nginx -v failed to check the version number

Solution: Configure Nginx environment variables

Execute the vi /etc/profile command, press shift + G to jump to the end, press I to enter the edit mode and add the following code to the end

export NGINX_HOME=/usr/local/nginx
export PATH=$PATH:$NGINX_HOME/sbin

1

Execute source /etc/profile command to reload the configuration file and view the version number.

2

Although there is no sbin, Nginx can still be started. Execute the /usr/local/nginx/sbin/nginx command to start Nginx. Execute ps -ef | grep nginx to check whether there is an Nginx process.

1

It took me half a day to finally figure out where the problem was.

Although the compressed package and the decompressed folder of Nginx are placed under the personal user, you can switch to the root user through su root and perform the Nginx installation operation. The final generated Nginx folder should be in the root directory, not under the personal user.

1

So, you should cd / to the root directory and check the sbin directory under usr/local/nginx folder. Does this path look familiar to you? That’s right, it’s the path configured in the environment variable!

2

Summarize:

For those who are not familiar with Linux virtual machines, it is important to distinguish between root users and personal users . I hope that after avoiding this mistake, I will not make the same mistake again.

//root root directory/usr/local/nginx
//Personal user directory /home/wanjk/usr/local/nginx/

This is the end of this article about how to solve the problem that the sbin directory is not generated after Nginx is installed. For more information about Nginx not generating the sbin directory, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to enable Nginx directory browsing function
  • How to set Nginx to prohibit access to a directory or file
  • How to redirect nginx directory path
  • How to set directory whitelist and IP whitelist in nginx
  • Example of how to install nginx to a specified directory
  • How to set up 301 redirection in ngin configuration and 301 redirection in nginx subdirectory
  • How to set nginx upload directory without execution permission
  • Enable directory browsing in Nginx browser

<<:  A brief discussion on Yahoo's 35 rules for front-end optimization

>>:  The difference between html empty link href="#" and href="javascript:void(0)"

Recommend

How to add automatic completion commands for docker and kubectl on Mac

Introduction to kubectl kubectl is a command line...

Summary of fragmented knowledge of Docker management

Table of contents 1. Overview 2. Application Exam...

Learn about CSS label display mode in one article

Tag type (display mode) HTML tags are generally d...

Summary of ten Linux command aliases that can improve efficiency

Preface Engineers working in the Linux environmen...

Introduction to the use of select optgroup tag in html

Occasionally, I need to group select contents. In ...

React + Threejs + Swiper complete code to achieve panoramic effect

Let’s take a look at the panoramic view effect: D...

A brief talk about the diff algorithm in Vue

Table of contents Overview Virtual Dom principle ...

How to export mysql query results to csv

To export MySQL query results to csv , you usuall...

Ubuntu 20.04 Best Configuration Guide (Newbie Essential)

1. System Configuration 1. Turn off sudo password...

How to implement JavaScript output of Fibonacci sequence

Table of contents topic analyze Basic solution Ba...

Some "pitfalls" of MySQL database upgrade

For commercial databases, database upgrade is a h...

Detailed steps for configuring virtual hosts in nginx

Virtual hosts use special software and hardware t...

Solution to the routing highlighting problem of Vue components

Preface Before, I used cache to highlight the rou...