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

The method of compiling and installing Nginx1.13 with Centos7 Source Code

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about how Centos7 source code compiles and installs Nginx1.13. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

I won't say anything about nginx. Since you choose nginx as your web server, you must have different understanding and understanding of nginx server, so I'll install it directly.

1. Prerequisites:

I am using the centos7.3 64-bit core system. Before installing and configuring nginx, you must install the nginx dependency package, please check it; Centos 7 compiles and installs the production of php7.1, and installs the dependency package provided at the beginning of the previous article. This dependent package applies to any version of Nginx.

New web users and groups

$/ usr/sbin/groupadd www$ / usr/sbin/useradd-g www www$ ulimit-SHn 65535 / / set linux high load parameters

two。 Download Nginx and OpenSSL from the official

There are two versions when downloading Nginx: the development version and the stable version. If you use it for production, download the stable version, and http://nginx.org/en/download.html (it's best to download the latest version of the stable version, so there will be bug fixes and new features). I downloaded the latest version of nginx-1.13.5.

$cd / tmp$ wget https://www.openssl.org/source/openssl-1.1.0e.tar.gz$ tar zxvf openssl-1.1.0e.tar.gz$ wget https://nginx.org/download/nginx-1.13.5.tar.gz$ tar zxvf nginx-1.13.5.tar.gz$ cd nginx-1.13.5

3. Install Nginx

You may notice that when installing nginx in some documentation tutorials, there are not so many modules assigned, (it looks very long), and some modules and users are not assigned, in fact, the modules are assigned according to their own needs, if you want to avoid trouble in the future, then you can assign them according to the following modules. In fact, this is omnipotent, otherwise what you need later will have to be recompiled, it is not very troublesome. But it's not easy. As for whether to assign a user group, I will firmly let you assign it, which is related to the availability and security stability of the nginx configuration.

$. / configure\-- prefix=/usr/local/nginx\-- user=www\-- group=www\-- with-pcre\-- with-openssl=/tmp/openssl-1.1.0e\-- with-http_ssl_module\-- with-http_v2_module\-with-http_realip_module\-- with-http_addition_module\-- with-http_sub_module\-- with-http_dav_module\-- with-http_flv_module\-- with-http _ mp4_module\-- with-http_gunzip_module\-- with-http_gzip_static_module\-- with-http_random_index_module\-- with-http_secure_link_module\-- with-http_stub_status_module\-- with-http_auth_request_module\-- with-http_image_filter_module\-- with-http_slice_module\-- with-mail\-with-threads\-- with-file-aio\-- with -stream\-- with-mail_ssl_module\-- with-stream_ssl_module\ $make-J8 & & make install / / compile and install

4. Create a systemctl system Nginx unit file

After the installation is completed, you also need to boot automatically, otherwise you need to start manually every time, isn't that too troublesome?

$vim / usr/lib/systemd/system/ nginx.service [Unit] Description=The nginx HTTP and reverse proxy serverAfter=syslog.target network.target remote-fs.target nss- lookup.target [Service] Type=forkingPIDFile=/usr/local/nginx/logs/nginx.pidExecStartPre=/usr/local/nginx/sbin/nginx-tExecStart=/usr/local/nginx/sbin/nginxExecReload=/bin/kill-s HUP / usr/local/nginx/logs/nginx.pidExecStop=/bin/kill-s QUIT / usr/local/nginx/logs/nginx.pidPrivateTmp= truth [install] WantedBy=multi-user.target

Save and exit.

5. Join Boot Auto Boot and start Nginx

$systemctl enable nginx.service$ systemctl restart nginx.service

6. Set up Firewalld Firewall

$firewall-cmd-zone=public-add-port=80/tcp-permanent$ firewall-cmd-reload

7. Check to see if Nginx starts successfully

$ss-ntlp

You can see that the nginx process is already running. At this point, the nginx installation is complete, and you may have questions about how nginx parses and supports php programs. Don't panic, I'll write about it in the next article.

Thank you for reading! On "Centos7 source code compilation and installation of Nginx1.13" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!

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