1. System information
Cat/etc/issue
CentOS release 6.5 (Final) Kernel \ r on an \ m
Uname-
Linux GHCLC6X-4352 2.6.32-431.29.2.el6.x86 _ 64 #1 SMP Tue Sep 9 21:36:05 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
2. Configure yum
Yum clean allyum makecacheyum update
3. Install nginx
Yum info nginx view nginx version information yum nginxservice nginx restartnetstat-ntpl | grep 80 check whether Port 80 process exists
3. Install nginx dependency packages
Yum install-y make apr * autoconf automake curl-devel gcc-c ++ gtk +-devel zlib-devel openssl-devel pcre-devel gd kernel keyutils patch perl kernel- headers compat * cpp glibc libgomp libstdc ++-devel keyutils-libs-devel libsepol-devel kernel-devel krb5-devel libXpm * freetype-devel freetype * fontconfig-devel liblibjpeg * libpng * -common php-gd gettext-devel ncurses * libtool * libxml2 libxml2-devel patch policycoreutils bison
4. Compile and install nginx (support for pseudo-static)
. /Configure -- prefix =/etc/nginx -- sbin-path =/usr/sbin/nginx -- conf-path =/etc/nginx. conf -- error-log-path =/Disk/log/nginx/error. log -- http-log-path =/Disk/log/nginx/access. log -- pid-path =/Disk/log/nginx/run/nginx. pid -- lock-path =/Disk/log/nginx/run/nginx. lock -- http-client-body-temp-path =/Disk/log/nginx/cache/client_temp -- http-proxy-temp-path =/Disk/log/nginx/cache/ proxy_temp -- http-fastcgi-temp-path =/Disk/log/nginx/cache/nginx/fastcgi_temp -- http-uwsgi-temp-path =/Disk/log/nginx/cache/ nginx/uwsgi_temp -- http-scgi-temp-path =/Disk/log/nginx/cache/nginx/scgi_temp -- user = nginx -- group = nginx -- with-http_ssl_module -- with-http_realip_module -- with-http_addition_module -- with-http_sub_module -- with-http_dav_module -- with-http_flv_module -- with-http_mp4_module -- with-http_gunzip_module -- with-http_gzip_static_module -- with-http_random_index_module -- with-http_secure_link_module -- with-http_stub_status_module -- with-http_auth_request_module -- with-mail -- with-mail_ssl_module -- with-file-aio -- with-ipv6 -- with-http_spdy_module -- with-cc-opt = '-O2-g-pipe-Wp, -D_FORTIFY_SOURCE = 2-fexceptions-fstack-protector -- param = ssp-buffer-size = 4-m64-mtune = generic '-- with-pcre =/Disk/nginx_source/pcre-8.35
5. tomcat call is supported to modify the configuration file
Cat ad. conf upstream test {server HostIP: Port weight = 20 max_fails = 2 fail_timeout = 30 s; ip_hash;} server {listen 80; server_name www.test.com; root/var/www/index; index index.html index.htm; location/{proxy_pass http: // test; proxy_set_header HOST $ host; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header X-Forwarded-FOR $ response ;} error_page 500 502 503 x.html; location =/50x.html {root/usr/share/nginx/html ;}}
This article from the "loyal to the country" blog, please be sure to keep this source http://xinsir.blog.51cto.com/5038915/1572796
Configure Nginx + Tomcat in Centos