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 preview pdf file using pdfjs in vue

Table of contents Preface think Library directory...

The difference and usage of Vue2 and Vue3 brother component communication bus

Table of contents vue2.x vue3.x tiny-emitter plug...

Detailed tutorial for downloading, installing and configuring MySQL 5.7.27

Table of contents 1. Download steps 2. Configure ...

Detailed explanation of Nginx regular expressions

Nginx (engine x) is a high-performance HTTP and r...

Use of LRU algorithm in Vue built-in component keep-alive

Table of contents The use of Vue's keep-alive...

MySQL max_allowed_packet setting

max_allowed_packet is a parameter in MySQL that i...

Implementation of iview permission management

Table of contents iview-admin2.0 built-in permiss...

Windows cannot start MySQL service and reports error 1067 solution

Suddenly when I logged into MySQL, it said that a...

IE8 compatibility notes I encountered

1. IE8's getElementById only supports id, not ...

Two implementation codes of Vue-router programmatic navigation

Two ways to navigate the page Declarative navigat...

VMware and CentOS system installation method to reset the root password

Today's Tasks 1. Choice of Linux distribution...

What we can learn from Google's new UI (pictures and text)

The most significant website change in 2011 was Go...