Amazon amozon AMI instance automatically installs Nginx script

  

Download Compile and install is very simple, several common dependencies must be installed first, so in order not to repeatedly look at the results of configure and then install the missing dependencies, directly This script can be installed. Save this script to any text format, sh can successfully install Nginx on Amazon's cloud host
#!bin/bashsudo yum install updatesudo yum install gcc pcre pcre-devel zlib-devel zlib openssl -ywget http: //nginx.org/download/nginx-1.2.8.tar.gztar -xzvf nginx-1.2.8.tar.gzcd nginx-1.2.8sudo ./configuresudo make &make install

NginxStart
sudo /usr/local/nginx/sbin/nginx

NginxControl
sudo /usr/local/nginx/sbin/nginx -s stop Stop the daemon immediately (with TEAM signal) sudo /usr/local/nginx/sbin /nginx -s quit Moderate stop daemon (with QUIT signal) sudo /usr/local/nginx/sbin/nginx -s reopen reopen log file sudo /usr/local/nginx/sbin/nginx -s reload reload Configuration file

If the configuration file is changed and the configuration file is invalid, you may not be able to terminate the Nginx daemon. At this time, you can use this method to terminate
sudo killall nginx to terminate the process. In an emergency, use

to test the configuration file. Br>sudo /usr/local/nginx/sbin/nginx -t [-c configuration file path]

Why do you want to test the configuration file? Because of a configuration error, it is likely to lose control of Nginx. As mentioned above, even if you can't stop the running service, you can only end the process in a mandatory way. This is not good, so you can First use this command to test whether the configuration file is correct, and then decide whether to use the configuration file.

After setting up the configuration file, you don't have to restart Nginx, just reload (see the reload command above), this is the same as Apache (many people say that changing the configuration file to restart Apache, in fact, no need, Just reload the configuration file to take effect, very quickly, and will not cause service interruption).

Copyright © Windows knowledge All Rights Reserved