资讯专栏INFORMATION COLUMN

Centos7 nginx安装与配置

nanchen2251 / 2163人阅读

摘要:启动关闭检查配置文件是否正确可以看到编译选项启动启动配置文件重新载入配置文件重启,不会改变启动时指定的配置文件停止或

一、安装编译工具及库文件
yum -y install make zlib zlib-devel gcc gcc-c++ libtool  openssl openssl-devel pcre pcre-devel  //PCRE 作用是让 Nginx 支持 Rewrite 功能
二、安装Nginx

1、下载Nginx至文件夹/usr/local内

cd /usr/local/     //进入目标目录
wget http://nginx.org/download/nginx-1.14.1.tar.gz  //下载nginx,选择稳定版本

2、解压缩文件包

tar zxvf nginx-1.14.1.tar.gz

3、进入安装目录,编译安装

./configure --prefix=/app/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: "/app/nginx"
  nginx binary file: "/app/nginx/sbin/nginx"
  nginx modules path: "/app/nginx/modules"
  nginx configuration prefix: "/app/nginx/conf"
  nginx configuration file: "/app/nginx/conf/nginx.conf"
  nginx pid file: "/app/nginx/logs/nginx.pid"
  nginx error log file: "/app/nginx/logs/error.log"
  nginx http access log file: "/app/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"

4、查看Nginx版本

/app/nginx/sbin/nginx -v
 #到此,nginx安装完成。

5、启动、关闭Nginx

检查配置文件是否正确     
/app/nginx/sbin/nginx -t 
/app/nginx/sbin/nginx -V     //可以看到编译选项

启动Nginx

/app/nginx/sbin/nginx     // 启动
/usr/local/nginx/conf/nginx.conf  //配置文件

重新载入配置文件

/app/nginx/sbin/nginx -s reload

重启Nginx,不会改变启动时指定的配置文件

/app/nginx/sbin/nginx -s reopen

停止Nginx

/app/nginx/sbin/nginx -s stop
#或
pkill nginx

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/33769.html

相关文章

  • Centos7 nginx安装配置

    摘要:启动关闭检查配置文件是否正确可以看到编译选项启动启动配置文件重新载入配置文件重启,不会改变启动时指定的配置文件停止或 一、安装编译工具及库文件 yum -y install make zlib zlib-devel gcc gcc-c++ libtool openssl openssl-devel pcre pcre-devel //PCRE 作用是让 Nginx 支持 Rewri...

    Little_XM 评论0 收藏0
  • Centos7 nginx安装配置

    摘要:启动关闭检查配置文件是否正确可以看到编译选项启动启动配置文件重新载入配置文件重启,不会改变启动时指定的配置文件停止或 一、安装编译工具及库文件 yum -y install make zlib zlib-devel gcc gcc-c++ libtool openssl openssl-devel pcre pcre-devel //PCRE 作用是让 Nginx 支持 Rewri...

    Near_Li 评论0 收藏0
  • linux基础命令介绍十一:软件包管理

    摘要:此时可以通过添加新的源来解决如中安装安装获取警告头密钥准备中正在升级安装此时中增加了一个新文件名称源地址是否检查,表示不检查这里等于表示不启用,为表示启用现在就可以通过命令安装了当服务器没有网络可用时,还能够设置本地源。 linux中软件包的管理随着系统发行版本的不同而不同,RPM和DPKG为最常见的两类软件包管理工具,分别应用于基于rpm软件包的linux发行版和基于deb软件包的l...

    wangshijun 评论0 收藏0
  • 使用passenger在Centos7部署nginx+Ruby on Rails

    摘要:是一个能快速搭建环境的工具,它能快速的将和部署到你的服务器中,是部署环境就如同环境那样简单快速,让人愉悦。在上跑一般只有在生产环境下才会使用,因而默认下就是环境设置为生产环境,而初始化时默认没有对生产环境进行密钥配置。 passenger passenger是一个能快速搭建web环境的工具,它能快速的将nginx和passenger部署到你的服务器中,是部署ruby环境就如同php环...

    UsherChen 评论0 收藏0
  • Centos7开发环境配置(一)

    摘要:一准备工具安装到本地目录文件名彻底删除文件夹二和环境配置我安装在虚拟机的上,压缩包放在了里面解压在了里头按一下键,末尾添加按一下键,退出编辑重新加载配置文件查看有没有自带卸载创建文件夹用远程文件上传的软件连接的,这里使用的软 一、准备SecureCRT工具安装到本地http://www.jb51.net/softjc/55...https://jingyan.baidu.com/art...

    RichardXG 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<