1、测试新的Nginx程序是否正确

[test@P-SH-Nginx-01 nginx]$ ./sbin/nginx -t

nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok

nginx: [emerg] open() "/usr/local/openresty/nginx/logs/access.log" failed (13: Permission denied)

nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed

2、启动Nginx

test@P-SH-Nginx-01 openresty]$ sudo ./nginx/sbin/nginx -c conf/nginx.conf

/usr/local/nginx/sbin/nginx -t

nginx: theconfiguration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx:configuration file /usr/local/nginx/conf/nginx.conf test issuccessful

3、查看Nginx是否已经启动起来

[test@P-SH-Nginx-01 openresty]$ ps -ef |grep nginx

root      46505      1  0 01:41 ?        00:00:00 nginx: master process ./nginx/sbin/nginx -c conf/nginx.conf

nobody    46506  46505  0 01:41 ?        00:00:00 nginx: worker process

test      46528  28392  0 01:42 pts/0    00:00:00 grep --color=auto nginx

4、查看Ngixn版本及其编译参数,注意参数是大写字母V

[test@P-SH-Nginx-01 openresty]$  ./nginx/sbin/nginx -V

nginx version: openresty/1.11.2.5

built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

built with OpenSSL 1.0.2k-fips  26 Jan 2017

TLS SNI support enabled

configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.10 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-http_stub_status_module --with-http_ssl_module

5、验证Nginx是否正常运行

[test@P-SH-Nginx-01 openresty]$ curl -I http://127.0.0.1

HTTP/1.1 200 OK

Server: openresty/1.11.2.5

Date: Fri, 15 Dec 2017 01:58:18 GMT

Content-Type: text/html

Content-Length: 562

Last-Modified: Thu, 26 Oct 2017 04:12:11 GMT

Connection: keep-alive

ETag: "59f1609b-232"

Accept-Ranges: bytes

6、重启Nginx

[test@P-SH-Nginx-01 openresty]$ sudo ./nginx/sbin/nginx -s reload

Nginx常用命令之启动与重启的更多相关文章

  1. Nginx常用命令(启动/重启/停止/测试配置文件/重新加载配置文件)

    Nginx 安装后只有一个程序文件,本身并不提供各种管理程序,它是使用参数和系统信号机制对 Nginx 进程本身进行控制的. Nginx 的参数包括有如下几个: 使用: /usr/local/ngin ...

  2. Nginx和PHP-FPM的启动、重启、停止脚本分享

    这篇文章主要介绍了Nginx和PHP-FPM的启动.重启.停止脚本分享,脚本中包含start.stop.reload.restart等常用的管理方法,并可以加入系统服务然后使用servicem命令管理 ...

  3. Nginx系列一:正向代理和反向代理、Nginx工作原理、Nginx常用命令和升级、搭建Nginx负载均衡

    转自https://www.cnblogs.com/leeSmall/p/9351343.html 仅供个人学习 一.什么是正向代理.什么是反向代理 1. 正向代理,意思是一个位于客户端和原始服务器( ...

  4. nginx常用命令及简单配置

    nginx常用命令 nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx(windows下start nginx); nginx -s quit 停止ng ...

  5. nginx常用命令汇总

    nginx基础命令: sudo nginx // 开启nginx服务器 sudo nginx -s reload // 重启nginx服务器 sudo nginx -s stop // 关闭nginx ...

  6. 【Linux】nginx常用命令

    相关内容链接 Centos之安装Nginx及注意事项 [nginx]详细配置说明 nginx常用命令 [重新加载配置]sudo nginx -s reload [打开nginx配置]sudo vim ...

  7. 记录Nginx常用命令

    在此记录下Nginx服务器常用命令(CentOS7.2.Nginx1.14.2环境) 启动Nginx:./usr/sbin/nginx Nginx检查语法:nginx -tc /etc/nginx/n ...

  8. nginx常用命令参数

    命令行参数: 常用命令: -c filename:设置配置文件. -t :不运行,而仅仅测试配置文件.nginx 将检查配置文件的语法的正确性,并尝试打开配置文件中所引用到的文件. -s :传递一个信 ...

  9. Nginx常用命令,解决你日常运维的烦恼

    前面,跟大家简单地介绍了负载均衡和Nginx的一些基础配置(Nginx负载均衡配置实例),接下来,跟大家介绍一下Nginx的常用命令,便于日常的运维. 查看原文 停止Nginx的方法 通过之前的学习, ...

随机推荐

  1. 【Python爬虫案例】用Python爬取李子柒B站视频数据

    一.视频数据结果 今天是2021.12.7号,前几天用python爬取了李子柒的油管评论并做了数据分析,可移步至: https://www.cnblogs.com/mashukui/p/1622025 ...

  2. 154寻找旋转排序数组中的最小值II

    title: 寻找旋转排序数组中的最小值II 题目描述 题目链接:寻找旋转排序数组中的最小值II 解题思路 和上题同理:数组特点有 nums[mid] < nums[right],最小值肯定在m ...

  3. mySql in 语句查询优化

    有这么一条sql UPDATE product set BuyerCount =BuyerCount+1 where ProductId in( SELECT ProductId from order ...

  4. PX4配置过程与踩坑

    0.前言 由于需要在GitHub下载代码,而国内访问受限,可能会出现一些问题,这里建议使用github国内镜像,参看:GitHub国内镜像网站,当然下面会给出具体解决方案. 1.步骤 1.1下载源码: ...

  5. docker安装nginx,配置SSL

    nginx安装 下载镜像并测试 1.docker pull nginx 2.docker images nginx 查看我们拉取到本地的nginx镜像IMAGE ID 3.首先测试下nginx镜像是否 ...

  6. (数据科学学习手札137)orjson:Python中最好用的json库

    本文示例代码及文件已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 大家好我是费老师,我们在日常使用Pytho ...

  7. Redis - Redlock算法

    Redis - Redlock算法 在Redis的分布式环境中,我们假设有N个Redis master.这些节点完全互相独立,不存在主从复制或者其他集群协调机制.之前我们已经描述了在Redis单实例下 ...

  8. C#/VB.NET 在Word转PDF时生成目录书签

    当我们在转换Word文档到PDF格式时,想保留Word文档的标题作为PDF书签,那么应该如何操作呢?那么本文将以C#及VB.NET代码为例,介绍如何在Word转PDF时生成目录书签.下面是具体方法和步 ...

  9. C# 将HTML转为XML

    本文以C#及VB.NET后端程序代码示例展示如何将HTML转为XML文件.转换时,调用Word API -Free Spire.Doc for .NET 提供的文档加载方法及文档保存的方法来实现.转换 ...

  10. React与Koa一起打造一个仿稀土掘金全栈个人博客(技术篇)

    本篇文章将分为前台角度与后台角度来分析我是怎么开发的.前台角度主要资源 react.js ant Design for-editor axios craco-less immutable react- ...