[root@client1 ~]# cd /etc/yum.repos.d/
[root@client1 yum.repos.d]# vim nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
[root@client1 yum.repos.d]# yum -y install nginx
[root@client1 yum.repos.d]# cd /etc/nginx/conf.d/
[root@client1 conf.d]# vim a.org.conf
server {
server_name www.a.org a.org;
error_log /usr/local/nginx/logs/a.org/error.org error;
access_log /usr/local/nginx/logs/a.org/access.log main;
location / {
root /a.org;
index index.html;
}
}
[root@client1 ~]# mkdir -p /usr/local/nginx/logs/a.org
[root@client1 ~]# mkdir -p /a.org
[root@client1 ~]# echo welcome to nginx > /a.org/index.html
[root@client1 ~]# cd /etc/nginx/conf.d/
[root@client1 conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@client1 conf.d]# systemctl star
nginx部署简单网站(centos7)
最新推荐文章于 2024-07-27 10:30:32 发布
本文详细介绍了如何在CentOS7操作系统中,通过Nginx服务器部署和配置一个简单的静态网站,包括安装Nginx、配置文件设置、网站文件上传及启动服务等步骤。
摘要由CSDN通过智能技术生成