CentOS下,yum安装nginx

一,准备篇
1,配置网络&关闭SELINUX&配置防火墙

配置网络&关闭SELINUX&配置防火墙

2,创建www用户
groupadd www && useradd -g www -s /bin/false www
二,安装篇
1,添加nginx官方yum源
vi /etc/yum.repos.d/nginx.repo
CentOS 6
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/6/$basearch/
gpgcheck=1
enabled=1
CentOS 7
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=1
enabled=1
2,下载nginx签名密钥
rpm --import http://nginx.org/keys/nginx_signing.key
3,yum安装
yum -y install nginx
4,启动nginx
CentOS 6
service nginx start
CentOS 7
systemctl start nginx.service
systemctl enable nginx.service
5,状态管理命令
CentOS 6
/etc/rc.d/init.d/nginx
service nginx start
service nginx stop
service nginx restart
service nginx condrestart
service nginx try-restart
service nginx force-reload
service nginx upgrade
service nginx reload
service nginx status
service nginx help
service nginx configtest
service nginx check-reload
chkconfig nginx on                       #启用开机自启
chkconfig nginx off                      #禁用开机自启
CentOS 7
/usr/lib/systemd/system/nginx.service
systemctl start nginx.service
systemctl stop nginx.service
systemctl restart nginx.service
systemctl reload nginx.service
systemctl status nginx.service
systemctl enable nginx.service             #启用开机自启
systemctl disable nginx.service            #禁用开机自启
6,相关软件目录及文件位置
/usr/sbin/nginx
/etc/nginx/nginx.conf
/var/lock/subsys/nginx
/var/run/nginx.pid
三,优化篇

暂无

参考文章

NGINX Yum存储库官方指南

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容