nginx.txt 986 B

12345678910111213141516171819202122232425262728293031323334
  1. nginx源码安装,下载地址:
  2. http://nginx.org/download/nginx-1.14.0.tar.gz
  3. 源码放置路径:
  4. /usr/local/nginx/source
  5. 默认安装模块,指定安装目录
  6. ./configure --prefix=/usr/local/nginx
  7. --with-http_stub_status_module --with-http_ssl_module
  8. --with-http_gzip_static_module --with-http_realip_module
  9. --with-http_sub_module --with-http_image_filter_module
  10. 依赖PCRE zlib等库
  11. make
  12. make install
  13. 1、nginxServer.sh 启动脚本
  14. sh nginxServer.sh start|stop|restart|reload
  15. 2、nginx开机自启动 (systemd)
  16. 1)、编辑nginx.service, 路径:/lib/systemd/system/nginx.service
  17. 2)、systemctl enable nginx.service (开机启动)
  18. 3)、systemctl daemon-reload
  19. 升级只需要把编译后nginx复制过去就行
  20. 1. cd /usr/local/nginx/source/
  21. 2. make
  22. 3. cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
  23. 4. /usr/local/nginx/sbin/nginx -s stop
  24. 5. cp /usr/local/nginx/source/objs/nginx /usr/local/nginx/sbin/nginx
  25. 6. /usr/local/nginx/sbin/nginx