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

Compile and install nginx-1.12.2 in CentOS7.5

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1 description

This document takes the Jilin examination project as an example to install and deploy nginx by compiling.

2 catalogue planning

Nginx version

Nginx source code package storage record

Nginx installation directory

Nginx stores the code directory

Nginx log directory

Nginx-1.12.2

Nginx-1.12.2

/ usr/local/nginx

/ home/yunwei/nginx-data

/ home/yunwei/nginx-logs

3 download nginx source code package

Create a directory for storing nginx source packages

Mkdir / usr/local/src/nginx

Download the nginx source package to the specified directory

Wget http://nginx.org/download/nginx-1.12.2.tar.gz-P / usr/local/src/nginx/

Decompress nginx source code packet

Tar xf / usr/local/src/nginx/nginx-1.12.2.tar.gz-C / usr/local/src/nginx/

4 compile and install nginx

Install dependency packages

Yum-y install pcre-devel openssl-devel

Create a nginx user

Useradd-s / sbin/nologin-M nginx

Create a nginx installation directory

Mkdir / usr/local/nginx

Cd / usr/local/src/nginx/nginx-1.12.2/

. / configure-prefix=/usr/local/nginx/-user=nginx-group=nginx-with-http_ssl_module-with-http_stub_status_module

Make & & make install

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

5 create a directory to store the code and logs

Mkdir / home/yunwei/nginx-data/jl_exam/jl_exam_poral/ROOT-p

Mkdir / home/yunwei/nginx-data/jl_exam/jl_exam_manage_view/ROOT/-p

Mkdir / home/yunwei/nginx-logs/jl_exam/-p

Chmod 755 / home/yunwei/

Chown-R nginx.nginx / home/yunwei/nginx-*

6 Editing the profile

Backup configuration fil

Cp / usr/local/nginx/conf/nginx.conf {, .ori}

Create a virtual host configuration file storage directory

Mkdir / usr/local/nginx/conf/extra/jl_exam

6.1 Editing the nginx.conf main configuration file

Cat > / usr/local/nginx/conf/nginx.conf / etc/rc.local # added to boot self-startup

8 Log slicing configuration

Use the logrotate of the system to cut nginx log files

Create a nginx_jl_exam file

Cat > / etc/logrotate.d/nginx_jl_exam

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