Linux_CentOS 7下Nginx服务器的安装配置
2024-08-27 23:08:41
1.安装
1.1 配置epel yum 源
wget http://dl.Fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-7.noarch.rpm
yum install nginx -y
1.2 查看确认 是否安装
[root@localhost ~]# rpm -qa | grep nginx
nginx-1.10.2-1.el7.x86_64
nginx-mod-stream-1.10.2-1.el7.x86_64
nginx-mod-http-geoip-1.10.2-1.el7.x86_64
nginx-all-modules-1.10.2-1.el7.noarch
nginx-mod-http-perl-1.10.2-1.el7.x86_64
nginx-mod-http-image-filter-1.10.2-1.el7.x86_64
nginx-mod-mail-1.10.2-1.el7.x86_64
nginx-filesystem-1.10.2-1.el7.noarch
nginx-mod-http-xslt-filter-1.10.2-1.el7.x86_64
1.3 查看 安装nginx 所生成的文件
[root@localhost ~]# rpm -ql nginx
/etc/logrotate.d/nginx
/etc/nginx/fastcgi.conf
/etc/nginx/fastcgi.conf.default
/etc/nginx/fastcgi_params
/etc/nginx/fastcgi_params.default
/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/mime.types
/etc/nginx/mime.types.default
/etc/nginx/nginx.conf
/etc/nginx/nginx.conf.default
/etc/nginx/scgi_params
/etc/nginx/scgi_params.default
/etc/nginx/uwsgi_params
/etc/nginx/uwsgi_params.default
/etc/nginx/win-utf
/usr/bin/nginx-upgrade
/usr/lib/systemd/system/nginx.service
/usr/lib64/nginx/modules
/usr/sbin/nginx
/usr/share/doc/nginx-1.10.2
/usr/share/doc/nginx-1.10.2/CHANGES
/usr/share/doc/nginx-1.10.2/README
/usr/share/doc/nginx-1.10.2/README.dynamic
/usr/share/doc/nginx-1.10.2/UPGRADE-NOTES-1.6-to-1.10
/usr/share/licenses/nginx-1.10.2
/usr/share/licenses/nginx-1.10.2/LICENSE
/usr/share/man/man3/nginx.3pm.gz
/usr/share/man/man8/nginx-upgrade.8.gz
/usr/share/man/man8/nginx.8.gz
/usr/share/nginx/html/404.html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/index.html
/usr/share/nginx/html/nginx-logo.png
/usr/share/nginx/html/poweredby.png
/usr/share/vim/vimfiles/ftdetect/nginx.vim
/usr/share/vim/vimfiles/indent/nginx.vim
/usr/share/vim/vimfiles/syntax/nginx.vim
/var/lib/nginx
/var/lib/nginx/tmp
/var/log/nginx
2.设置
2.1 启动nginx
systemctl start nginx
2.2 设置开机启动
systemctl enable nginx
2.3 查看nginx 启动状态
systemctl status nginx
2.4 查看是否监听
ss -tnl | grep 80
LISTEN 0 128 *:80 *:*
LISTEN 0 128 :::80 :::*
2.5 测试 nginx
在浏览器中输入 nginx 服务器的ip 地址(localhost:80)
如果能看到测试页面,说明已经正常安装~
备注:如果不能正常访问,关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
最新文章
- 关于js中this关键字的补充
- Angularjs2 入门
- DSP(1) -- 离散时间信号的序列类型
- struts2中一些常用的写法 记录
- surge for mac出测试版本了
- setAttribute()和getAttibute(),getParameter()
- Spring-MVC配置方法
- php 调试工具及学习PHP垃圾回收机制了解引用计数器的概念
- ASP.NET MVC 传值方法ViewData与ViewBag的区别
- LeetCode中有技巧的题需要面试前记得的
- openstack domain serverID connect uri
- bzoj1115: [POI2009]石子游戏Kam
- CSS多级数字序号的目录列表(类似3.3.1.这样的列表序号)
- jquery动态改变背景颜色插件
- Thrift源码解析--transport
- day_1 练习2
- java 多线程(0) Java线程
- 《Web安全深度剖析》
- Windowns Server 2016 + Nginx 1.10.2 + PHP 7.1.0 + Laravel 5.3 + Mariadb 10.1.19 开发环境设置
- Docker Swarm redis 集群搭建
热门文章
- 扫描仪扫描文件处理-Photoshop批处理内存不足问题解决
- spring boot:使用spring cache+caffeine做进程内缓存(本地缓存)(spring boot 2.3.1)
- oozie.action.hadoop.LauncherException: IO error Connection timed out: no further information
- JS错误写法[清除DOM]
- 不可不知的资源管理调度器Hadoop Yarn
- Git操作文件的时候手贱了,怎么恢复?
- 【API进阶之路】研发需求突增3倍,测试团队集体闹离职
- rsync 守护进程模式搭建 与常见报错
- MySql与Oracle的几个主要区别
- Redis学习笔记(三)——数据结构之字符串(String)