Nginx的安装步骤
- To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with the following contents。
执行$ vim /etc/yum.repos.d/nginx.repo,在nginx.repo中写入如下内容:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/CentOS/7/$basearch/
gpgcheck=0
enabled=1
注:如果不配置nginx.repo,将无法通过yum安装nginx;
2. 使用yum install nginx命令完成nginx的安装;
3. 执行systemctl start nginx.service 启动nginx服务,如果成功启动,则说明nginx安装成功;
关于Nginx的配置
最新版的nginx主配置文件是/etc/nginx/nginx.conf
如果需要配置Web服务器,请在/etc/nginx/conf.d/中添加扩展名为.conf的文件,/etc/nginx/nginx.conf将自动加载conf.d目录下的conf文件。
例如,我们可以使用nginx配置Django项目,点击查看详情
本文详细介绍了如何在RHEL/CentOS上通过配置yum源来安装Nginx,并提供了启动服务的方法。同时,还介绍了Nginx的配置文件路径及如何通过添加.conf文件进行Web服务器配置。
2153

被折叠的 条评论
为什么被折叠?



