linux安装nginx步骤
yum -y install epel-release
yum -y install nginx
systemctl start nginx
systemctl enable nginx
- 访问是否成功,http://ip 即可,页面是下面两种,这其实是nginx的欢迎页面(每个版本的nginx各不相同),这并不代表nginx没有正常启动,需要可以修改/usr/share/nginx/html目录下的index.html,可修改成自己想要的页面
nginx 安装卸载
nginx 安装卸载
linux卸载nginx步骤
systemctl stop nginx
chkconfig nginx off
yum remove nginx
rm -rf /usr/sbin/nginx
rm -rf /etc/nginx
rm -rf /etc/init.d/nginx
nginx的gz包安装
yum -y install gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel
- 官网下载安装包,上传至linux系统
- 解压,zxvf显示解压文件
tar zxf nginx-1.17.1.tar.gz
cd nginx-1.17.1
- 编译,默认https没有打开,需要添加 --with-http_ssl_module
./configure --with-http_ssl_module
make && make install
/usr/local/nginx/sbin/nginx
nginx的相关命令
启 动: systemctl start nginx
关 闭: systemctl stop nginx
重 启: systemctl restart nginx
重新加载: systemctl restart nginx
辅助命令
查看防火墙状态: firewall-cmd --state
更新防火墙规则: firewall-cmd --reload
关闭防火墙: systemctl stop firewalld.service
打开防火墙: systemctl start firewalld.service
永久开放80端口: firewall-cmd --zone=public --add-port=80/tcp --permanent