网站首页 > 技术教程 正文
安装Nginx
1、解决依赖关系
编译安装 nginx 需要事先需要安装开发包组 ”Development Tools” 和 “Development Libraries” 。同时,还需要专门安装 pcre-devel 包:
yum -y install pcre-devel
2、安装
首先添加用户 nginx ,实现以之运行 nginx 服务进程:
groupadd -r nginx
useradd -r -g nginx nginx
关闭 iptables 和 selinux
service iptables stop
chkconfig iptables off
setenforce 0
接着开始编译和安装:
# ./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \ --user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \ --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre
make && make install
创建软连接
# ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx
说明:如果想使用 nginx 的 perl 模块,可以通过为 configure 脚本添加–with-http_perl_module 选项来实现,但目前此模块仍处于实验性使用阶段,可能会在运行中出现意外,因此,其实 现方式这里不再介绍。如果想使用基于 nginx 的 cgi 功能,也可以基于 FCGI 来实现,具体实现 方法请参照网上的文档。
3、为 nginx 提供 SysV init 脚本 :
新建文件 /etc/rc.d/init.d/nginx ,内容如下:
而后为此脚本赋予执行权限:
chmod +x /etc/rc.d/init.d/nginx
添加至服务管理列表,并让其开机自动启动:
chkconfig --add nginx
chkconfig nginx on
而后就可以启动服务并测试了:
service nginx start
猜你喜欢
- 2024-10-12 webserver神器 nginx安装(webmin nginx)
- 2024-10-12 Nginx学习笔记(nginx从入门到实践)
- 2024-09-26 CentOS7搭建nginx环境(centos7搭建http)
- 2024-09-26 CentOS7.3安装配置Nginx教程(centos7安装详细图解配置ip)
- 2024-09-26 135页阿里云OSS运维基础实战手册,图文结合一看就懂,仅分享2天
- 2024-09-26 Centos 6.5部署nginx+php环境部署
- 2024-09-26 nginx负载均衡配置(nginx负载均衡配置,当前机器宕机)
- 2024-09-26 Openresrt最佳案例 | 第1篇:Nginx介绍
- 2024-09-26 nginx 源码安装并开启gzip静态压缩
- 2024-09-26 记录一次nginx升级,支持ipv4和ipv6访问https
你 发表评论:
欢迎- 最近发表
-
- Win10 TH2正式版官方ESD映像转换ISO镜像方法详解
- 使用iso镜像升级到Windows 10的步骤
- macOS Ventura 13.2 (22D49) Boot ISO 原版可引导镜像
- 安利一个用ISO镜像文件制作引导U盘的的小工具RUFUS
- CentOS 7使用ISO镜像配置本地yum源
- 用于x86平台的安卓9.0 ISO镜像发布下载:通吃I/A/N、完全免费
- AlmaLinux 9.6发布:升级工具、初步支持IBM Power虚拟化技术
- Rufus写入工具简洁介绍与教程(写入模式)
- 新硬件也能安装使用了,Edge版Linux Mint 21.3镜像发布
- 开源工程师:Ubuntu应该抛弃32位ISO镜像
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)