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

Centos installation nginx tutorial

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

Share

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

1. Install dependent components

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

2. Download the installation package

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

3. Compilation and installation

tar zxvf nginx-1.16.0.tar.gz

cd nginx-1.16.0

./ configure --prefix=/usr/local/nginx

make && make install

4, Start nginx service

cd /usr/local/nginx/sbin

./ nginx

5. Verify whether the service starts successfully

[root@localhost sbin]# netstat -ntlp | grep nginx

tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 130245/nginx: master

6, Add nginx service

vi /lib/systemd/system/nginx.service

Document content:

[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*

7, using systemd management

pkill nginx

systemctl start nginx

systemctl status nginx

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