1. View system information
// Run the uname command to view the operating system information-a// Check the system version cat /etc/redhat-release // Check the port usage netstat-tunlp // Kill processeskill-9 PID // Uninstalling nginx yum remove nginxCopy the code
Install and compile tools and library files
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
Copy the code
3. Install PCRE
// The PCRE function is to make Nginx support Rewrite functionality
1Run the following command to download the PCRE installation package: CD /usr/local/src/wget/ / downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
2Decompress the installation package tar ZXVF pcre8.35.tar.gz
3Go to the installation package directory and compile and install CD PCre8.35
./configure
make && make install
4To check the pcRE version, see pcre-config --versionCopy the code
Install nginx
1/usr/local/ SRC/wget HTTP: /usr/local/ SRC/wget/ / nginx.org/download/nginx-1.17.1.tar.gz
tar zxvf nginx1.171..tar.gz
2Go to the installation package directory and compile the installation CD nginx1.171.
./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre8.35
make
make install
3Version, view nginx/usr/local/webserver/nginx/sbin/nginx - vCopy the code
5. Common commands
/ / into the directory/usr/local/webserver/nginx/sbin
1/nginx -t command to check the correctness of configuration file nginx.conf2/nginx or./nginx -s start3/nginx -s reload4/ nginx-s reopen5/nginx -s stop6/ nginx-vCopy the code
Six, notes
-
Configuration file modification: Uncomment user, then change nobody to root
-
Global command invalid solution
vim /etc/profile
# add nginx execution file path
# nginx
export PATH="/usr/local/nginx/sbin:$PATH"
Save environment variables
source /etc/profile
Copy the code
- Configuring Multiple Directories
- Self-start upon startup
- Nginx log
- To improve the…
References: Link 1, Link 2, Link 3, link 4