前言
年纪大了总忘事,记录一些用过的和常用的命令,以后想用的时候可以看看,嘻嘻~
配置
先进入nginx安装目录
# cd /opt/nginx/nginx-1.20.1/
看帮助
英文好的可以看下,可以看到模块名哦~
# ./configure --help
配置和启用模块(重要)
普通配置,确定安装目录
# ./configure --prefix=/opt/nginx/nginx-1.20.1/
增加模块配置,比如我要启用ssl和status模块,那就加上–with-${模块名}
# ./configure --prefix=/opt/nginx/nginx-1.20.1/ --with-http_ssl_module --with-http_stub_status_module
安装
# cd /opt/nginx/nginx-1.20.1/
# make && make install
检查配置文件是否OK
应该是自动检查/conf下的*.conf文件吧
# nginx -t
启动Nginx服务
指定配置文件启动
# nginx -c /opt/nginx/nginx-1.20.1/conf/nginx.conf
停止Nginx服务
我不优雅,暴力点就好了,哈哈
# pkill -9 nginx
查看Nginx版本和详细信息
注意大小写,小v只是看版本,大V不仅可以看版本还可以看启用的模块
只看版本
# nginx -v
nginx version: nginx/1.20.1
看版本和启用的模块等
# nginx -V
nginx version: nginx/1.20.1
built by gcc 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
built with OpenSSL 1.1.1g FIPS 21 Apr 2020
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx/nginx-1.20.1/ --with-http_ssl_module