Because I have been tinkering with Linux recently, I wanted to install a new version of nginx. I looked for a tutorial but couldn't find the corresponding one. After a little tinkering, I finally successfully installed the latest version. The server environment is centos, the following are the detailed steps: Install necessary dependency plugins 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 (if you want to install other versions, you can go to the official website link below and select the link of other versions to copy and replace) wget https://nginx.org/download/nginx-1.16.0.tar.gz Unzip and install tar zxvf nginx-1.16.0.tar.gz cd nginx-1.16.0 ./configure --prefix=/usr/local/nginx make && make install Adding global commands ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx Test the installation As shown below, the installation is successful: Verify that the service is started successfully netstat -ntlp | grep nginx as follows: Add nginx service vim /lib/systemd/system/nginx.service Insert the following into: [Unit] Description=nginx After=network.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target Start nginx as a service pkill nginx systemctl start nginx Check whether the service is started systemctl status nginx netstat -ntlp | grep nginx Configure nginx service to start automatically at boot systemctl enable nginx Now the installation is complete, the configuration file is: vim /usr/local/nginx/conf/nginx.conf Optional: The version number of nginx is turned on by default and can be viewed in the default error page and http response header. Different versions, especially lower versions of nginx, may have vulnerabilities, so if you don't want others to obtain the version number, you can choose to hide the version number. Hide nginx version number cd /usr/local/nginx/conf vim nginx.conf Change the "server_tokens" in the nginx.conf file to "off": http { ... server_tokens off; ... } Modify fastcgi.conf again Modify the following line fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; # Change to: fastcgi_param SERVER_SOFTWARE nginx; Restart nginx systemctl restart nginx Hide version number completed Summarize The above is a detailed tutorial on how to install Nginx 1.16.0 under Linux. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time! You may also be interested in:
|
<<: The use and difference between JavaScript pseudo-array and array
>>: A brief discussion of 3 new features worth noting in TypeScript 3.7
1. CSS3 triangle continues to zoom in special eff...
I just started learning about databases recently....
Tomcat defines multiple ClassLoaders internally s...
The css animation of the rotating flip effect, th...
1. Introduction to MariaDB and MySQL 1. Introduct...
need Configuring DingTalk alarms in Zabbix is s...
This article describes how to install mysql5.6 us...
First, let me talk about the general idea: 1. Log...
HTML code: <a onclick="goMessage();"...
In this chapter, we will start to operate redis i...
Preface JavaScript is not like other languages ...
Preview address: https://ovsexia.gitee.io/leftfix...
This article example shares the specific code of ...
conda update conda pip install tf-nightly-gpu-2.0...
Stored procedures and coding In MySQL stored proc...