Nginx compilation, configuration, basic command learning

1. Installation

  1. Reference address for installation and startup
Software package Description
pcre-devel Provide regular expression library for Nginx modules (such as rewrite)
zlib-devel Provide a data compression library for Nginx modules (such as gzip)
openssl-devel Provide functions such as cryptographic algorithm, certificate and SSL protocol for Nginx modules (such as ssl)
  1. Install Nginx related dependencies in yum mode
//由于openssl-devel依赖于zlib-devel,所以命令中省略zlib-devel。
yum -y install pcre-devel openssl-devel

  1. Compile and install
    Enter the decompressed Nginx directory and execute the following command:
./configure  --prefix=/usr/local/nginx  --with-http_ssl_module
make && make install
  1. linux open port command
//开端口
iptables -I INPUT -p tcp --dport 80 ACCEPT
//查看
service iptables status
//保存到防火墙规则中
service iptables save
//重启防火墙
service iptables restart

2. Common commands

command Description
nginx -s reload When nginx has been started, reload the configuration file (smooth restart)
nginx -s reopen Reopen the log file
nginx -c /specific directory/nginx.conf Start nginx with the nginx configuration file in a specific directory
nginx -t Monitor whether the current nginx configuration file is correct
nginx -t -c /specific directory/nginx.conf Check whether the nginx configuration file in a specific directory is correct
nginx -v Display version information
nginx -V Display version information and compilation options

Guess you like

Origin blog.csdn.net/polixiaohai/article/details/90212585