First, Ngnix installation
The installation of the Ngnix is simple
1, first download from Ngnix official website Ngnix compression Package
wget http://nginx.org/download/nginx-1.6.2.tar.gz
2. Unzip and enter the directory
TAR-ZXF nginx-1.6.2.tar.gz
CD nginx-1.6.2
3. Compile and install
./configure--prefix=/usr/local/ngnix
#此处有可能报错, Ngnix relies on the Pcre library, so install the Pcre library first
Yum Install pcre Pcre-deveyum install Pcre Pcre-deve
Make && make install
Installation succeeded at this time
4. Start
Go to Cd/usr/local/ngnix and look at the 4 directories inside.
... conf configuration file
... HTML Web page file
... logs log files
... sbin main binary program
Start:./sbin/ngnix
This may cause an error.
(1)
Workaround:
(2)
Workaround: Turn off the software or service that occupies port 80.
Second, the signal volume
Nginx to use the signal to control the Nginx stop, smooth restart, nginx support the following several signals:1) term,int fast close SIGINT SIGTERM namely: Ngx_terminate_signal and SIGINT2) QUIT calmly closed (graceful closing process, i.e., after the request is over and then closed) sigquit that is ngx_shutdown_signal3) HUP Smooth Restart, reload configuration file SIGHUP i.e. ngx_reconfigure_signal4) USR1 re-open the log file, the use of large SIGUSR1 when cutting the log ngx_reopen_signal5) USR2 Smooth upgrade executable program SIGUSR2 i.e. ngx_changebin_signal6) WINCH calmly close the work process that is ngx_noaccept_signal three, virtual host configurationFirst look at the configuration filevim/usr/local/ngnix/conf/ngnix.conf Let's configure the virtual host.(1) domain-based virtual host
(2) port-based virtual host configuration (3) IP-based virtual host configuration (if a host has two network cards)
Ngnix installation, Semaphore, virtual host configuration