Nginx是异步框架的网页服务器,也可以用作反向代理、负载平衡器和HTTP缓存。该软件由伊戈尔·赛索耶夫创建并于2004年首次公开发布。2011年成立同名公司以提供支持。2019年3月11日,Nginx公司被F5 Networks以6.7亿美元收购。 Nginx是免费的开源软件,根据类BSD许可证的条款发布.
请确保你以具有 root 权限的用户身份登录, 并且你没有在端口 80 或 443 上运行 Apache 或任何其他服务。
按照以下步骤在 CentOS 服务器上安装 Nginx:
> yum install epel-release
> yum install nginx
如果这是你第一次从 EPEL 存储库安装软件包,yum 可能会提示你导入 EPEL GPG 密钥:
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7Importing GPG key 0x352C64E5:Userid : "Fedora EPEL (7) <epel@fedoraproject.org>"Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5Package : epel-release-7-noarch (@extras)From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7Is this ok [y/N]:
如果是这种情况,请键入
y
并点击Enter
。
> systemctl enable nginx //开机启动> systemctl start nginx //启动Nginx服务
使用以下命令检查 Nginx 服务的状态:
> systemctl status nginx
输出应如下所示:
使用以下命令打开必要的端口:
> firewall-cmd --permanent --zone=public --add-service=http> firewall-cmd --permanent --zone=public --add-service=https> firewall-cmd --reload
http://IP
你可以像管理 任何其他 systemd 单元一样管理 Nginx 服务。
systemctl stop nginx
systemctl start nginx
systemctl restart nginx
systemctl reload nginx
systemctl enable nginx
systemctl disable nginx
/etc/nginx/
目录中。/etc/nginx/nginx.conf
.conf
以/etc/nginx/conf.d
目录结尾并存储在目录中。你可以根据需要拥有任意数量的服务器块。rumenz.com
那么你的配置文件应该命名为/etc/nginx/conf.d/rumenz.com.conf
access.log
和error.log
)位于该/var/log/nginx/
目录中。建议有不同access
,并error
为每个服务器模块的日志文件。/home/<user_name>/<site_name>/var/www/<site_name>/var/www/html/<site_name>/opt/<site_name>/usr/share/nginx/html
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。