Linus安装nginx部署静态网页

Winona ·
更新时间:2024-09-21
· 756 次阅读

Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供IMAP/POP3/SMTP服务。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,第一个公开版本0.1.0发布于2004年10月4日。

1.添加yum源 rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

在这里插入图片描述

2.yum安装 yum install -y nginx

在这里插入图片描述

3.启动 systemctl start nginx.service

在这里插入图片描述
这样安装就完成了,可以直接访问服务器的域名或公网ip,出现如下页面,就算是成功了。
在这里插入图片描述

4.常用命令 查看版本 nginx -v 查看nginx进程和安装目录 ps -ef | grep nginx 检查配置文件 nginx -t 启动 systemctl start nginx.service 停止 systemctl stop nginx.service 重启 systemctl restart nginx.service 设置开机自启动 systemctl enable nginx.service 取消开机自启动 systemctl disable nginx.service 查看当前状态 systemctl status nginx.service 查看所有已启动的服务 systemctl list-units --type=service 5.部署静态网页 切换到默认配置文件目录 cd /etc/nginx/conf.d 新建一个conf文件 vi xxx.conf 写入如下内容 server { listen 8082; #访问的端口 server_name localhost; #访问主机 location / { root /home/business/xxx; #网页所在目录,默认访问index.html文件,可自定义目录。 } } 重启nginx服务 systemctl restart nginx.service
作者:千月落



静态 静态网页 Nginx

需要 登录 后方可回复, 如果你还没有账号请 注册新账号