centos7如何自主正确地安装配置Nginx?
Admin 2023-07-04 群英技术资讯 1481 次浏览
今天就跟大家聊聊有关“centos7如何自主正确地安装配置Nginx?”的内容,可能很多人都不太了解,为了让大家认识和更进一步的了解,小编给大家总结了以下内容,希望这篇“centos7如何自主正确地安装配置Nginx?”文章能对大家有帮助。yum -y install make zlib zlib-devel gcc gcc-c++ libtool openssl openssl-devel pcre pcre-devel
(PCRE 作用是让 Nginx 支持 Rewrite 功能)
1、下载Nginx
下载地址:http://nginx.org/,选择稳定版本(例如:nginx-1.12.0.tar.gz)
2、将下载的二进制包移动到/usr/local目录,解压缩文件包
tar zxvf nginx-1.12.0.tar.gz
3、进入安装目录,编译安装
cd nginx-1.12.0
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-pcre --with-http_ssl_module
make
make install
安装完成后的摘要信息:
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
默认安装到/usr/local/nginx目录。
4、查看Nginx版本
/usr/local/nginx/sbin/nginx -v
输出结果如下:
nginx version: nginx/1.12.0
到此,nginx安装完成。
5、启动、关闭Nginx
#检查配置文件是否正确
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -V # 可以看到编译选项
#启动Nginx
/usr/local/nginx/sbin/nginx # 默认配置文件 /usr/local/nginx/conf/nginx.conf,-c 指定
# 重新载入配置文件
/usr/local/nginx/sbin/nginx -s reload
#重启Nginx,不会改变启动时指定的配置文件
/usr/local/nginx/sbin/nginx -s reopen
#停止Nginx
/usr/local/nginx/sbin/nginx -s stop
或
pkill nginx
1、创建Nginx运行使用的用户www
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
2、配置nginx.conf,将/usr/local/nginx/conf/nginx.conf替换为以下内容
[plain] view plain copy
四、防火墙配置
CentOS7默认的防火墙为firewall
添加防火墙规则如下:
#firewall-cmd --add-port=80/tcp //http协议基于TCP传输协议,放行80端口
现在大家对于centos7如何自主正确地安装配置Nginx?的内容应该都有一定的认识了吧,希望这篇能对大家有所帮助。最后,想要了解更多,欢迎关注群英网络,群英网络将为大家推送更多相关的文章。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
猜你喜欢
小编今天主要给大家介绍下“Linux系统如何重启apache”的相关内容,如果你对这方面比较感兴趣的话,不妨来看一看小编所整理的资料,或多或少能帮助大家解决问题。
linux下如何删除目录文件?Linux中要实现删除目录下的文件有很多方法,这篇文章就给大家分享介绍一下删除当前目录下的文件和删除指定目录下的文件的方法,感兴趣的朋友可以参考,接下来我们一起来看看吧。
linux可以运行两个tomcat。运行方法:1、利用“vim /etc/profile”命令写入环境变量,并利用“source /etc/profile”使配置生效;2、修改“apache-tomcat-10.0.12/conf”目录下的“server.xml”文件;3、修改两个“tomcat/bin”目录下的“startup.sh”与“shutdown.sh”文件即可。
linux中有access函数;该函数用于检查用户对一个文件的权限情况,若指定的存取方式有效,则函数返回0,反之则函数返回“-1”,语法为“int access(const char* pathname, int mode);”。
这篇文章主要介绍了Linux使用xinetd服务的管理方法案例详解,本篇文章通过简要的案例,讲解了该项技术的了解与使用,以下就是详细内容,需要的朋友可以参考下
成为群英会员,开启智能安全云计算之旅
立即注册关注或联系群英网络
7x24小时售前:400-678-4567
7x24小时售后:0668-2555666
24小时QQ客服
群英微信公众号
CNNIC域名投诉举报处理平台
服务电话:010-58813000
服务邮箱:service@cnnic.cn
投诉与建议:0668-2555555
Copyright © QY Network Company Ltd. All Rights Reserved. 2003-2020 群英 版权所有
增值电信经营许可证 : B1.B2-20140078 ICP核准(ICP备案)粤ICP备09006778号 域名注册商资质 粤 D3.1-20240008