在lnmp环境中的nginx怎么编译安装

发布时间:2022-04-29 16:28:32 作者:iii
来源:亿速云 阅读:117

本篇内容主要讲解“在lnmp环境中的nginx怎么编译安装”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“在lnmp环境中的nginx怎么编译安装”吧!

我用的linux系统是 centos7.1。

如果linux系统没有预先安装 gcc 等编译软件可以用yum源安装。安装nginx,首先需要安装依赖模块pcre、zlib、openssl。

gzip 模块需要 zlib 库

rewrite 模块需要 pcre 库

ssl 功能需要 openssl库

1.安装pcre依赖

2.安装zlib依赖

3.安装openssl依赖

4.安装nginx服务

手动创建 nginx 用户与用户组

groupadd nginx

useradd nginx -g nginx -s /sbin/nologin -m

./configure --prefix=/opt/project/nginx-1.14 #nginx 安装位置
--sbin-path=/opt/project/nginx-1.14/sbin/nginx #设置nginx可执行文件路径
--conf-path=/opt/project/nginx-1.14/config/nginx.conf #设置nginx配置文件路径
--pid-path=/opt/project/nginx-1.14/logs/nginx.pid #设置nginx.pid文件
--error-log-path=/opt/project/nginx-1.14/logs/error.log #设置主错误,警告,和诊断文件的名称
--lock-path=/opt/project/nginx-1.14/logs/nginx.log \
--http-log-path=/opt/project/nginx-1.14/logs/access.log #设置主请求的http服务器的日志文件的名称
--with-http_ssl_module
--user=nginx \
--group=nginx \
--with-pcre=/var/software/nginx/pcre-8.38 #指的是pcre 的源码路径
--with-zlib=/var/software/nginx/zlib-1.2.11 #指的是zlib 的源码路径
--with-openssl=/var/software/nginx/openssl-1.1.1-pre5 #指的是openssl 的源码路径

user nginx nginx;

启动nginx /opt/project/nginx/nginx

重启nginx /opt/project/nginx/nginx -s reload

杀掉进程 pkill -9 nignx

查看端口 netstat -ano|grep 80

查看进程 ps -ef|grep nginx
6>

在lnmp环境中的nginx怎么编译安装

如果访问不了,需要关闭防火墙。

centos7 查看防火墙状态
firewall-cmd --state #running 防火墙运行中 (not running 已关闭)

关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

如果在安装过程中,遇到问题请自行google,因为系统的差异遇到的错误可能不太一样。

到此,相信大家对“在lnmp环境中的nginx怎么编译安装”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

推荐阅读:
  1. LNMP环境部署之---PHP编译安装。
  2. LNMP - 编译安装PHP

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

lnmp nginx

上一篇:CentOS6.5环境安装nginx服务器及负载均衡配置的方法

下一篇:Linux服务器下该怎么安装配置Nginx

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》