CentOS 7.9 安装 nginx-1.22.0( 二 )


systemctl enable nginx.service执行完后,系统会在下方提示:
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.看到这个,nginx 的服务就已经完成添加,但这个时候,还没有启动的,我们可以通过下面的命令来操作nginx 。
# 查看运行状态systemctl status nginx

CentOS 7.9 安装 nginx-1.22.0

文章插图
其他命令
# 启动 nginxsystemctl start nginx# 停止 nginxsystemctl stop nginx# 重新加载 nginxsystemctl reload nginx如果重新修改 nginx.service 配置文件后,则需要使用下面的命令来重新加载服务的配置文件 。
# 重新加载服务的配置文件systemctl daemon-reload八、nginx 配置使用源码安装方式,nginx的配置文件,通常会在  /usr/local/nginx/conf/nginx.conf  这个位置,可以通过 vi 或 vim 修改 。
# 打开配置文件vim /usr/local/nginx/conf/nginx.conf九、防火墙# 关闭防火墙systemctl stop firewalld# 开放3306端口命令firewall-cmd --zone=public --add-port=3306/tcp --permanent# 配置立即生效firewall-cmd --reload云主机需配置安全组(默认已放行,可省略)
在入方向规则,允许80放行
CentOS 7.9 安装 nginx-1.22.0

文章插图
十、问题记录错误:./configure: error: the HTTP rewrite module requires the PCRE library.
解决:安装pcre-devel:yum -y install pcre-devel
错误:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using –without-http-cache option, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using –with-http_ssl_module –with-openssl= options.
解决:yum -y install openssl openssl-devel
错误:

经验总结扩展阅读