wget http://nginx.org/download/nginx-1.2.1.tar.gz
mv nginx-1.2.1.tar.gz /usr/src/redhat/SOURCES/
cd /usr/src/redhat/SOURCES/
vim nginx.spec

  1. Summary: high performance web server 
  2. Name: nginx 
  3. Version: 1.2.1 
  4. Release: 1.el5.ngx 
  5. License: 2-clause BSD-like license 
  6. Group: Applications/Server 
  7. Source: http://nginx.org/download/nginx-1.2.1.tar.gz 
  8. URL: http://nginx.org/ 
  9. Distribution: Linux 
  10. Packager: zhoutao <zhoutao@zhoutao.name> 
  11.  
  12. %description 
  13. nginx [engine x] is a HTTP and reverse proxy server, as well as a mail proxy server 
  14. %prep 
  15. rm -rf $RPM_BUILD_DIR/nginx-1.2.1 
  16. zcat $RPM_SOURCE_DIR/nginx-1.2.1.tar.gz | tar -xvf - 
  17. %build 
  18. cd nginx-1.2.1 
  19. ./configure --prefix=/usr/local/nginx --without-http_rewrite_module 
  20.  make 
  21. %install 
  22. cd nginx-1.2.1 
  23. make install 
  24. %preun 
  25. if [ -z "`ps aux | grep nginx | grep -v grep`" ];then 
  26. killall nginx >/dev/null 
  27. exit 0 
  28. fi 
  29. %files 
  30. /usr/local/nginx 


rpmbuild --bb nginx.spec