Check which modules are enabled when nginx is installed

If your nginx is installed by rpm package, use the following command directly: nginx -V
If you are compiling and installing from source package, if your installation path is /usr/local/nginx, then you can use: /usr/local/nginx/ sbin/nginx -V
Note the capital V , so you can see the modules that nginx has loaded.

Compilation, installation and configuration of Nginx serverhttp:
//jingyan.baidu.com/article/25648fc1bf60a29191fd00d3.htmlTo

compile and install Nginx, first we need to install the dependency packages pcre-devel and zlib-devel:
# yum install pcre-devel zlib-devel The -y
program runs as nobody by default. We recommend using the nginx user to run it. First add the Nginx group and user, do not create a home directory, and do not allow login to the system
# groupadd nginx
# useradd -M -s /sbin/nologin -g Nginx

After the preparation of nginx is completed, it is to download, compile and install Nginx. You can download it from the network disk provided by me, or you can download it from the official website of Nginx.
First decompress the source package:
# tar xf nginx-1.4.4.tar.gz
Then cd to the decompressed directory to execute ./configure
# cd nginx-1.4.4
Specify the installation directory and the owner and group for runtime, and enable the status monitoring module, etc.
# ./configure \
  --prefix=/usr/local/nginx \
  --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_stub_status_module \
  -- with-http_gzip_static_module \ --http
  -client-body-temp-path=/var/tmp/nginx/client/ \
  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
  --http- fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
  --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ --http
  -scgi-temp-path=/var/tmp/ nginx/scgi \
  --with-pcre
After the configuration is complete, you can make && make install
# make && make install
# mkdir /var/tmp/nginx/client/ -pv

After the compilation and installation are completed, the Nginx directory will appear under /usr/local, enter this Found the directory after the directory is very simple. Its configuration files are stored in the conf directory, web files are stored in html, log files are stored in logs, and there is only one executable program "nginx" in the sbin directory.
Next, we simply provide it with a service script!
# vim /etc/init.d/nginx
Create a new file /etc/rc.d/init.d/nginx with the following contents:
#!/bin/bash
# chkconfig:235 85 15
# description: Nginx is an HTTP server
. /etc/rc.d/init.d/functions
start() {
        echo "Start..."
        /usr/local/nginx/sbin/nginx &> /dev/null
        if [ $? -eq 0 ];then
                echo "Start successful!"
        else
                echo "Start failed!"
        be
}
stop() {
        if killproc nginx -QUIT ;then
                echo "Stopping..."
        be
}
restart() {
        stop
        sleep 1
        start
}
reload() {
        killproc nginx -HUP
        echo "Reloading..."
}
configtest() {
        /usr/local/nginx/sbin/nginx -t
}
case $1 in
start)
        start ;;
stop)
        stop ;;
restart)
        restart ;;
reload)
        reload ;;
configtest)
        configtest ;;
*)
        echo "Usage: nginx {start|stop|restart|reload|configtest}"
        ;;
esac

Then give this file executable permissions:
# chmod +x /etc/init.d/nginx
Ok, now you can use start, stop these parameters to control the Nginx service

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326655747&siteId=291194637