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 nginx with multiple instances of shell script

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

Share

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

This article mainly explains the "shell script multi-instance deployment of nginx", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "shell script multi-instance how to deploy nginx" bar!

1. Create a directory to store scripts and installation packages

[root@localhost nginx] # tree. ├── install.sh └── packages └── nginx-1.20.1.tar.gz1 directory, 2 files [root@localhost nginx] #

two。 Download the corresponding installation package

[root@localhost packages] # wget https://nginx.org/download/nginx-1.20.1.tar.gz[root@localhost packages] # lsnginx-1.20.1.tar.gz [root@localhost packages] #

3. Write a script

[root@localhost nginx] # cat install.sh #! / bin/bashlog_dir=/var/loginstall_dir=/usr/localid nginx & > / dev/nullif [$?-ne 0]; then useradd-r-M-s / sbin/nologin nginxfiyum-y install pcre-devel pcre gcc gcc-c++ openssl-devel zlib zlib-devel make vim wget openssl openssl-devel gd-develif [!-d $log_dir/nginx] Then mkdir-p $log_dir/nginx chown-R nginx.nginx $log_dir/nginxfiif [!-d $install_dir/nginx-1.20.1]; then tar xf packages/nginx-1.20.1.tar.gz-C $install_dirficd $install_dir/nginx-1.20.1if [!-d $install_dir/nginx] Then. / 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=/var/log/nginx/access.log\-error-log-path=/var/log/nginx/error.log make & & make installfiecho "export PATH=$install_dir/nginx/sbin:$PATH" > / etc/profile.d/nginx.shcat > / 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