Introduction
Nginx (pronounced the same as engine x) is an asynchronous framework web server, which can also be used as a reverse proxy, load balancer and HTTP cache . The software was created by Igor Sysoev and was first publicly released in 2004. The company of the same name was established in 2011 to provide support.
yum install gcc-c++
PCRE (Perl Compatible Regular Expressions) is a Perl library, including Perl compatible regular expression libraries.
The http module of nginx uses pcre to parse regular expressions, and pcre-devel is a secondary development library developed using pcre.
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
wget http://nginx.org/download/nginx-1.9.9.tar.gz
tar -zxvf nginx-1.9.9.tar.gz
cd to file path
Compile
. /configure --prefix=/usr --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/tem/nginx/client --http-proxy-temp-path=/var/tem/nginx/proxy --http-fastcgi-temp-path=/var/tem/nginx/fcgi --with-http_stub_status_module
make && make install
nginx -c /etc/nginx/nginx.conf
[emerg] getpwnam("nginx") failed
error executionuseradd -s /sbin/nologin -M nginx
id nginx
[emerg] mkdir() "/var/temp/nginx/client" failed (2: No such file or directory)
sudo mkdir -p /var/tem/nginx/client
sudo firewall-cmd --permanent --zone=public--add-service=http
sudo firewall-cmd --permanent --zone=public--add-service=https
sudo firewall-cmd --reload
To add CentOS 7 EPEL repository, open a terminal and use the following command:
sudo yum install epel-release
Now that the Nginx repository has been installed on your server, use the following yum command to install Nginx:
sudo yum install nginx
After answering yes to the prompt, Nginx will complete the installation on the server.
Nginx will not start by itself. To run Nginx, enter:
sudo systemctl start nginx
If you are running a firewall, run the following command to allow HTTP and HTTPS communication:
sudo firewall-cmd --permanent --zone=public--add-service=http
sudo firewall-cmd --permanent --zone=public--add-service=https
sudo firewall-cmd --reload
If you want to enable Nginx at system startup. Please enter the following command:
sudo systemctl enable nginx
Recommended Posts