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 deploy and install nginx

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

Share

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

In this issue, Xiaobian will bring you about how to deploy nginx installation. The article is rich in content and analyzes and narrates it from a professional perspective. After reading this article, I hope you can gain something.

First you need to download the Nginx package

Nginx official download address: nginx official download connection

It is recommended to choose a stable version of the software. If you practice using it, of course, it doesn't matter. Any version can be used. After downloading, start our installation.

Linux installation source code build Nginx

I use centos here to represent linux, other versions of linux are similar

1. First install the missing dependencies:

yum -y install gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel

These packages are recommended to be installed and deployed using yum. If not available on yum, you can download the source code to compile and install them. Just pay attention to the default installation directory at compile time. Make sure that these dynamic library files can be found when installing nginx below. When choosing these software, it is recommended to install stable versions, not the latest versions, of course, practice using it certainly does not matter

2. Unzip the package:

tar zxf nginx-version -C decompression path

Where nginx-version refers to the software version of nginx, -C specifies the decompression path

3. configured

Go to extract nginx file:

cd nginx decompression path

View current path

pwd Check if you have entered the relevant path

/opt/nginx-version This is the path I extracted

Yum installation dependency package configuration method

./ configure --prefix= install path--with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module

Compile the configuration method for installing dependent packages (in which the files are separated into separate directories)

./ configure

--prefix= specify root directory location/

--sbin-path= executable file directory/

--conf-path= directory where configuration files are stored/

--error-log-path=error Log file directory/

--http-log-path=access log file directory/

--pid-path=pid file directory/

--user= executing user/

--group= execution user group/

--with-http_ssl_module /

--with-http_stub_status_module /

--with-http_gzip_static_module /

--with-pcre=pcre package installation directory

--with-zlib=zlib package installation directory

For the specific use of each module of nginx, please move to: nginx compilation and installation configuration module Daquan

Compile to executable file

make

deployment setup

make install

Start Up Close Nginx

start nginx

Enter the sbin directory in nginx and directly execute the nginx program.

./ nginx sh nginx source nginx

Close nginx

./ nginx -s stop

Reload configuration file

./ nginx -s reload

manager installation

Use the package manager (rpm package) to install, here for convenience I use yum here to install, this installation method is much more convenient than compiling installation, and later startup will also be improved, but this package can not be changed after installation, can not add other third-party modules

Configure yum source

cat /etc/yum.repo.d/nginx.repo

[nginx]

name=nginx repo

baseurl=http://nginx.org/packages/centos/$releasever/$basearch/

gpgcheck=0

enabled=1

After configuration, install directly. Install by executing the following command.

yum -y install nginx

Using this installation method to start is also relatively simple, because after installation is the default system service program can be directly used in the following way

Before Centos7

service nginx start //start

service nginx stop //Close

service nginx restart //new startup

After centos7

systemctl start nginx.service //start

systemctl stop nginx.service //Close

systemctl restart nginx.service //restart

Windows installation

Windows installation nginx is simple, download the software package directly after decompression can be, free installation

Below is the content of the file after I unpacked it

Windows to start nginx there are many ways, you can directly double-click nginx.exe program can start directly, close nginx can directly end the process of the way to end; there are many ways to start the end, I will teach you here a conventional way to start

Open cmd, which is the command line shell.

The shortcut key win+r will appear as follows

Enter cmd and then enter and open the shell command line tool as shown below

start nginx

Enter the nginx decompression directory

start nginx

No reaction after execution indicates successful execution

Access using a browser

Close nginx

After entering, check the shell that started nginx before you will find that it has recovered to the situation just opened, indicating that the stop is successful.

OK, here it is installed.

The above is how to deploy nginx for everyone to share, if there is a similar doubt, you may wish to refer to the above analysis to understand. If you want to know more about it, please pay attention to 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