System environment centos 5.5 64bit kernel 2.6
1. Before installing nginx, you must install the required dependent packages
(1) Install a series of gcc things, and the general server has already installed the installation process:
Yum Cy install gcc gcc Cc++ autoconf automake
(2) Install support for third-party libraries of nginx Installation command:
yum -y install zlib zlib-devel openssl openssl-devel pcre
pcre-devel
2. Go to the official website of nginx (www.nginx.net) to download the nginx version (I installed nginx0.7.67)
Installation command: tar: zcvf nginx.0.7.67.tar.gz
Cd nginx.0.7.67
./configure
Make
Sudo make install
3. The installation is completed above. There is nginx installed under /usr/local/ by default.
Start under sbin
Start command: ./nginx
4. I use the integration of nginx+tomcat
(1) Nginx integration tomcat process 1 Submit a paragraph in nginx.conf
upstream tomcat_server{
server 192.168.12.205:8080; –ip and port
}
server {
listen 80;
server_name 192.168.12.205;
#charset koi8-r;
#access_log logs/host.access.log main;
access_log logs/205.log combined; –write your log files
location / {
# root html;
index index.html index.htm index.jsp index.do;
root /usr/server/sites/videopro; –dynamic project path
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
index index.do index.jspa index.htm index.jsp;
proxy_pass http://tomcat_server; — this is the name of your upstream
}
5. Restart nginx to see if it starts successfully
(1) Startup method 1, first kill the nginx process:
Order:
Check the signal type of nginx: Ps- ef | grep nginx
Kill CQUIT nginx main process number or kill CQUIT
‘/user/local/nginx/logs/nginx.pid’
start /user/local/nginx/sbin/nginx
(2) Stop nginx quickly
Kill CTERM nginx main process number
Kill -TERM ‘……./nginx.pid’
start /user/local/nginx/sbin/nginx
(3) Forcibly kill the nginx process pkill -9 nginx
(4).Smooth start kill CHUP nginx main process number kill CHUP
‘/user/local/nginx/logs/nginx.pid’