Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Nginx1.16.0 in a linux environment

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to install Nginx1.16.0 in the linux environment, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

Install the necessary dependent plug-ins

Yum install-y gcc gcc-c++ pcre\ pcre-devel zlib zlib-devel openssl openssl-devel wget

Create a folder and switch to it

Mkdir / customer & & cd / customer

Download the installation package (also if you want to install another version, you can go to the following link on the official website and select the link for another version to copy and replace)

Wget https://nginx.org/download/nginx-1.16.0.tar.gz

Extract and install

Tar zxvf nginx-1.16.0.tar.gzcd nginx-1.16.0./configure-- prefix=/usr/local/nginxmake & & make install

Add global command

Ln-s / usr/local/nginx/sbin/nginx / usr/bin/nginx

Test installation

Nginx-V

As shown in the following figure, the installation is successful:

Verify that the service started successfully

Netstat-ntlp | grep nginx

As follows:

Add nginx service

Vim / lib/systemd/system/nginx.service

Insert the following:

[Unit] Description=nginxAfter= network.target [service] Type=forkingExecStart=/usr/local/nginx/sbin/nginxExecReload=/usr/local/nginx/sbin/nginx-s reloadExecStop=/usr/local/nginx/sbin/nginx-s quitPrivateTmp= truth [install] WantedBy=multi-user.target

Start nginx as a service

Pkill nginxsystemctl start nginx

Check to see if the service starts

Systemctl status nginx netstat-ntlp | grep nginx

Configure nginx service boot to start automatically

Systemctl enable nginx

Now the installation is complete, and the configuration file is located in:

Vim / usr/local/nginx/conf/nginx.conf

Optional:

The version number of nginx is turned on by default and can be found in the default error page and http response header.

Different versions, especially lower versions of nginx, may have vulnerabilities, so if you do not want to be obtained by others, you can choose to hide the version number.

Hide nginx version number

Cd / usr/local/nginx/confvim nginx.conf

Change the "server_tokens" of the nginx.conf file to "off":

Http {... server_tokens off;...}

Modify fastcgi.conf again

Vim fastcgi.conf

Modify the following line

Change fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;# to: fastcgi_param SERVER_SOFTWARE nginx

Restart nginx

Systemctl restart nginx on how to install Nginx1.16.0 in the linux environment to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report