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

Native JS to achieve draggable login box

This article shares a draggable login box impleme...

Detailed explanation of props and context parameters of SetUp function in Vue3

1. The first parameter props of the setUp functio...

In-depth explanation of binlog in MySQL 8.0

1 Introduction Binary log records SQL statements ...

A few steps to easily build a Windows SSH server

The SSH mentioned here is called Security Shell. ...

Detailed explanation of Vue-Jest automated testing basic configuration

Table of contents Install Configuration Common Mi...

How to check if the firewall is turned off in Linux

1. Service method Check the firewall status: [roo...

Detailed explanation of docker version es, milvus, minio startup commands

1. es startup command: docker run -itd -e TAKE_FI...

Computed properties and listeners details

Table of contents 1. Calculated properties 1.1 Ba...

Defining the minimum height of the inline element span

The span tag is often used when making HTML web p...

Detailed explanation of Linux environment variable configuration strategy

When customizing the installation of software, yo...

Embed codes for several older players

The players we see on the web pages are nothing m...