【问题】
查看nginx的安装配置信息,有安装了哪些模块:
nginx -V
报错:
-bash: nginx: command not found
【方法】
编辑 /etc/profile ,在文末添加:
export PATH=/usr/local/nginx/sbin:$PATH
生效配置:
source /etc/profile
一句话:
echo -e '\n\nexport PATH=/usr/local/nginx/sbin:$PATH\n' >> /etc/profile && source /etc/profile
重新查看nginx配置:
nginx -V
输出:
nginx version: nginx/1.19.2 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) built with OpenSSL 1.0.2t 10 Sep 2019 TLS SNI support enabled configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_v2_module --with-openssl=./openssl-1.0.2t --add-module=./ngx_cache_purge-2.3 --add-dynamic-module=./headers-more-nginx-module --add-dynamic-module=./ModSecurity-nginx