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

What is the process of installing nginx with shell script source code

2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly explains "what is the process of installing nginx in the source code of shell script". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the process of installing nginx with shell script source code"?

SHELL concept

What is SHELL? SHELL is the bridge between Linux kernel and users.

SHELL is also a command interpreter. Users can enter commands to SHELL,SHELL and pass them to the Linux kernel. After kernel processing, the kernel is returned to SHELL,SHELL and the returned results are returned to the user terminal

SHELL is shell, middleware, there are many kinds of shell, bash, csh, ksh, zsh and so on.

What does SHELL have to do with SHELL programming? SHELL is a bridge between the command interpreter, the user and the operating system, while SHELL programming is based on the SHELL interpreter to achieve specific functions or requirements.

Interpretation between SHELL commands, SHELL scripts, SHELL programming, and SHELL?

SHELL programming purpose

The purpose of SHELL programming is to turn repetitive work into automation, which can be understood as batch processing

The main purpose of SHELL is to reduce frequent manual operations, improve the efficiency of operation and maintenance, and ensure the stable and efficient operation of the website.

For example, if you need source code to compile the LNMP WEB architecture, what if all 20 of them need to compile?

How to turn on Shell programming

Any programming language is derived from Hello,world

SHELL programming is actually writing SHELL commands to a script file.

SHELL programming specification, the first line of the script must be #! At the beginning, followed by the type of SHELL, such as / bin/bash,/bin/sh, etc.

The following script looks at the process of installing nginx in the source code of the shell script.

[root@localhost ~] # vim nginx.sh [root@localhost ~] # cat nginx.sh #! / bin/bashversion=nginx-1.20.1.tar.gzname=nginx-1.20.1install_dir=/usr/locallog=/var/log/nginx# solves dependencies yum-y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel wget gd-devel gcc gcc-c++yum-y groups mark install 'Development Tools'# create user id nginx & > / dev/nullif [$?-ne 0] Then useradd-s / sbin/nologin nginx fi# create log storage directory if [!-d $log] Download then mkdir-p / var/log/nginx chown-R nginx.nginx / var/log/nginx fi# nginxcd / usr/src/wget http://nginx.org/download/$version# extract tar xf $version mv $name nginxcd nginx/ & &. / configure\-- prefix=$install_dir/nginx\-- user=nginx\-- group=nginx\-- with-debug\-- with-http_ssl_module\-- with-http_realip_module\-- with-http_image_filter _ module\-- with-http_gunzip_module\-- with-http_gzip_static_module\-- with-http_stub_status_module\-- http-log-path=$log/access.log\-- error-log-path=$log/error.logmake & & make install# configure environment variable echo "export PATH=$install_dir/nginx/sbin:\ $PATH" > / etc/profile.d/nginx.shsource / etc/profile.d/nginx.sh# create service file cat > / usr/lib/systemd/system/nginx.service

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

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report