CentOs7.3 compile and install Nginx 1.9.9

CentOs7.3 compile and install Nginx 1.9.9

installation##

Installation dependencies###

$ yum install -y  gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel

Download and unzip###

$ cd /opt/
$ wget http://nginx.org/download/nginx-1.9.9.tar.gz
$ tar zxvf nginx-1.9.9.tar.gz

Compile###

You can specify compilation parameters when compiling, refer to the end of the article: Common Compilation Options

$ cd nginx-1.9.9
$ ./configure 

installation###

$ make
$ make && make install

Installed by default in /usr/local/nginx

There are four directories:

Common commands##

Correctness check###

Check every time you modify the nginx configuration file

$ /usr/local/nginx/sbin/nginx -t
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

start up###

$ /usr/local/nginx/sbin/nginx

If you cannot access, check the firewall and turn off the firewall

Centos 6.x close iptables

$ service iptables status #Query firewall status command
$ service iptables stop #Close command

Centos 7.x close firewall

$ ssystemctl status  firewalld.service #Check status
$ systemctl stop firewalld.service #Stop firewall

Enter the local IP in the browser and see the following content to prove that the installation is successful

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

stop###

$ /usr/local/nginx/sbin/nginx -s stop

Restart###

$ /usr/local/nginx/sbin/nginx -s reload

Common compilation options##

. /configure \
- - prefix=/home/nginx \
- - sbin-path=/usr/sbin/nginx \
- - user=nginx \
- - group=nginx \
- - conf-path=/etc/nginx/nginx.conf \
- - error-log-path=/home/log/nginx/error.log \
- - http-log-path=/home/log/nginx/access.log \
- - with-http_ssl_module \
- - with-http_gzip_static_module \
- - with-http_stub_status_module \
- - with-http_realip_module \
- - pid-path=/home/run/nginx.pid \
- - with-pcre=/home/software/pcre-8.35 \
- - with-zlib=/home/software/zlib-1.2.8 \
- - with-openssl=/home/software/openssl-1.0.1i

Option description##

- - prefix=/home/nginx \The root path of Nginx installation,All other paths depend on this option
- - sbin-path=/usr/sbin/nginx \The path of the nginx executable file (nginx)
- - user=nginx \The user the worker process is running on
- - group=nginx \The group in which the worker process runs
- - conf-path=/etc/nginx/nginx.conf \Point to the configuration file (nginx.conf)
- - error-log-path=/var/log/nginx/error.log \Point to the error log directory
- - http-log-path=/var/log/nginx/access.log \Set the name of the log file of the HTTP server of the main request
- - with-http_ssl_module \Use https protocol module. By default, this module is not built. The premise is openssl and openssl-devel is installed
- - with-http_gzip_static_module \Enable ngx_http_gzip_static_Module support (online real-time compression output data stream)
- - with-http_stub_status_module \Enable ngx_http_stub_status_Module support (get the working status of nginx since the last start)
- - with-http_realip_module \Enable ngx_http_realip_Module support (this module allows to change the client's IP address value from the request header, the default is off)
- - pid-path=/var/run/nginx.pid \Point to the pid file (nginx.pid)

Set the source path of the PCRE library, if it has been installed via yum, use –with-pcre finds the library file automatically. Use --with-pcre=PATH, you need to download the source code of the pcre library from the PCRE website (version 4.4 – 8.30) Decompress and leave the rest to Nginx./Configure and make to complete. Perl regular expressions are used in the location directive and ngx_http_rewrite_module module.
- - with-pcre=/home/software/pcre-8.35 \ 

Specify zlib (version 1.1.3 – 1.2.5) The source code decompression directory. The network transmission compression module ngx enabled by default_http_gzip_Need to use zlib when module.
- - with-zlib=/home/software/zlib-1.2.8 \

Point to the openssl installation directory
- - with-openssl=/home/software/openssl-1.0.1i

Contact

Recommended Posts

CentOs7.3 compile and install Nginx 1.9.9
CentOS 6.x compile and install Nginx
Centos compile and install Git
Centos7 compile and install ntp-4.2.8p11
CentOS 6.9 compile and install python
CentOS 6 compile and install python 3
Centos7 install Nginx
Compile and install LAMP under Centos 5.2
CentOS7 compile and install L(A|N)MP environment
Linux CentOS6 compile and install Pyt
Install centos7 and connect
Compile and install libmodbus library under CentOS7
CentOS7.5 source code compile and install mysql5.7.29
Centos7 compile and install MySQL8 problem record
Compile and install nodejs and yum in Centos8
CentOS7.4 source code compile and install MySQL8.0
Centos6.5 compile and install LNMP architecture web environment
Centos7.2 compile and install way to build phpMyAdmin
centos7 install python3 and ipython
Know Linux and install CentOS
CentOS 7 install Mono and MonoDevelop
Ubuntu 16.04 compile and install PHP 7.2
ubuntu18.04 compile and install python3.8
CentOS6.5 install Java 8 and Tomcat8
Centos6.5 install and configure mongodb
Tencent Cloud Centos install nginx
CentOS7 install python3 and pip3
CentOS7 install OracleJDK and JRE
CentOS6.5 install Java 8 and Tomcat8
CentOS6 install and crack Jira 7
CentOS6.5 install Java 8 and Tomcat8
CentOS6 install and crack confluence
CentOS6 install and crack Jira 7
Install Nginx server on CentOS 7
Centos compile and install LAMP (apache-2.4.7 + mysql-5.5.35 + php 5.5.8) + Redis
1.5 Install Centos7
Compile and install Lnmp shell script under Linux centos
"Source Production Control" series (2) Using Nginx 1.18 on CentOS 8: Compile, Install and Basic Use
Centos 7 install jdk and package service service
CentOS7 yum install and start mysql
Install and configure keepalived under CentOS 5.9
CentOS 8 install Git and basic configuration
CentOS 7 install Nginx, PHP, MySQL packages
How to install Nginx on CentOS 8
CentOS7.2 and Nginx configuration virtual host
CentOS7.3 install iptables and detailed use
CentOS quickly install Python3 and pip3
CentOS7 yum install and start mysql
CentOS 8 - install and configure NFS service
Centos7 and centos8 install mysql5.6 5.7 8.0 so simple
Centos7 uninstall openJdk, and install JDK1.8
Install Python3 and ansible under CentOS8
Install and use docker under CentOS 6.8
CentOS7 install and use SQL Server
Centos install php73 fast cgi + nginx
CentOS Minimal install and configure TIPS
Install Python3 and Py under CentOS7
Install and configure FreeIPA in Centos7
Nginx-ubuntu install Nginx and configure https
Compile and install QEMU under Ubuntu
virtualBox install centos, and build tomcat