---
title: "nginx pid No such file or directory解决办法"
author: "快快乐乐的北斗"
date: "2017-06-14T11:36:45Z"
tags: []
categories: ["企业架构"]
slug: "nginx-pid-no-such-file-or-directory"
draft: false
lastmod: "2017-06-14T11:36:45Z"
id: 2379325
url: "https://newday.iteye.com/blog/2379325"
---

服务器重启后，有时会需要重新启动nginx，采用

```
nginx -s reload 
```

 提示

```
nginx: [error] open() "/var/run/nginx.pid" failed (2: No such file or directory)
```

 是因为服务器重启时丢了pid文件。

这种情况下可以使用nginx -c，具体如下（nginx.conf位置自行替换）

```
nginx -c /etc/nginx/nginx.conf
```