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 the Nginx source code

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

Share

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

This article shows you how to install the Nginx source code, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.

Download the Nginx source file

Go to the nginx website to download the stable version of nginx. I downloaded 1.10.0.

Download: wget http://nginx.org/download/nginx-1.10.0.tar.gz

Decompress: tar-zxvf nginx-1.10.0.tar.gz

Check installation dependencies

Execute the following command to install the dependent libraries for nginx:

Yum-y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel

Configure Nginx installation options

Here I only configure to install to the / opt directory, other options can be performed. / configuration-help view.

Cd nginx installation directory, execute the following command:

. / configure-prefix=/opt/nginx-sbin-path=/usr/bin/nginx

Official website parameter configuration description: http://nginx.org/en/docs/configure.html

IV. Compile and install

Make & & make install

Start, stop and restart

# 1. Start nginxshell > nginx# via ps-ef | grep nginx to check whether nginx has been started successfully # 2. Stop nginxshell > nginx-s stop# 3. Restart shell > nginx-s reload

After the nginx default configuration starts successfully, there will be two processes, a main process (daemon) and a worker process. The main process is responsible for managing the worker process, and the worker process is responsible for handling the user's http requests.

6. Configure nginx to boot

The / usr/bin/nginx command is added to the / etc/rc.d/rc.local file, and the rc.local file is executed when the system boots. However, CentOS7 recommends that the boot service be written as a service description file to add to the system service, so rc.local does not have execution permission by default, so you need to add execution permission to it.

Shell > vim / etc/rc.d/rc.local# add the following parameters / usr/bin/nginxshell > chmod + x / etc/rc.d/rc.local the above is how to install the Nginx source code, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

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