Install and configure Nginx under Linux

Source: Internet
Author: User

Here is an example of the nginx-1.13.12 version

1, first to the official website download nginx-1.13.12.tar.gz install package and upload to the Linux server and unzip the installation package

TAR-ZXVF nginx-1.13.12.tar.gz

2, before installing the ngxin, we must first ensure that the Linux firewall is off state

Systemctl Stop Firewalld.service #停止
Firewall systemctl disable Firewalld.service #禁止firewall开机启动?
Firewall-cmd--state #查看默认防火墙状态 (show notrunning after turn off, show running when turned on)

3, install the C + + compilation environment, if you have installed the Ignore can

Yum Install gcc-c++
Is this OK [y/d/n]: Y

Installation Successful
Test

[Email protected] nginx-1.13.12]# gcc
GCC: Fatal error: No input file
Compile interrupts.
[[email protected] nginx-1.13.12]# make
Make: * No target is specified and makefile is not found. Stop it.

4, install some of the relevant dependencies of Nginx

Yum install-y pcre Pcre-devel
Yum install-y zlib Zlib-devel
Yum Install-y OpenSSL Openssl-devel

5, after the installation of dependencies into the folder after the Nginx decompression

Executes the command./configure--prefix=/home/demo/nginx
/home/demo/nginx This path is the installation directory for the specified ngxin

6. After the installation is completed, the LS command will find that there will be more than one makefile file in the Unpacked folder.

7. Start the installation
Command: Make
Command: Make install

8. View the installation directory

[Email protected] nginx]# Cd/home/demo/nginx
[[email protected] nginx]# ls
Conf HTML logs Sbin

9. Start Nginx

[Email protected] nginx]# CD sbin/
[[email protected] sbin]# ls
Nginx
[Email protected] sbin]#./nginx

View process

[[Email protected] sbin]# PS aux|grep nginx
Root 7779 0.0 0.0 20544 612? Ss 05:27 0:00 nginx:master process./nginx
Nobody 7780 0.0 0.1 23076 1636? S 05:27 0:00 Nginx:worker Process
Root 7884 0.0 0.0 112720 984 pts/2 s+ 05:29 0:00 grep--color=auto nginx
Accessing server Tests

10. Close Nginx

[[email protected] sbin]#./nginx-s stop
[[Email protected] sbin]# PS aux|grep nginx
Root 7951 0.0 0.0 112720 984 pts/2 s+ 05:33 0:00 grep--color=auto nginx

11. Reload the configuration file

./nginx-s Reload

Install and configure Nginx under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.