Windows PowerShell 中启动 Nginx 报错解决方案

简介: Windows PowerShell 中启动 Nginx 报错解决方案

首先看一下报错提示:

46eb0ee4add6454691a79875214aa732.png


我这里由于配置了多个 nginx.conf 配置文件,默认情况下,直接双击nginx.exe 即可运行,默认加载的是 conf\nginx.conf 配置文件。

那么有多个配置文件时,我们启动就需要指定加载配置文件了。

start nginx -c ./conf/nginx-2.conf
start 是启动命令
nginx 就是nginx.exe 服务
-c 表示指定配置路径参数
-c 后面的内容 ./conf/nginx-2.conf 表示你要加载的 nginx 配置文件

具体报错信息:
InvalidOperation: (:) [Start-Process],InvalidOperationException

+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

PowerShell 在不使用绝对路径时会出现问题,所以这里我用绝对路径即可启动成功。

start E:\nginx-1.10.2\nginx.exe -c E:\nginx-1.10.2\conf\nginx-2.conf

4f786a67490c413a9ca74a0bc744e886.png

相关文章
|
6月前
|
Unix Shell Windows
Windows PowerShell技巧:使用findstr实现类似grep的功能
显示带有线路编号**: `/N`选项将显示每条结果前面带有其在线路上出现位置编号。
1036 7
|
6月前
|
存储 Windows
Windows PowerShell操作:如何删除环境变量
此外,还有一些第三方工具可以用来管理环境变量,这些工具通常提供了更为用户友好的界面来添加、编辑或删除环境变量,但是使用PowerShell可以更直接地控制这些设置,并且可以很容易地集成到脚本中以自动化环境配置的管理。
849 7
|
9月前
|
应用服务中间件 Linux 网络安全
使用Nginx免费版与Keepalived实现高可用性High Availablity方案
本文介绍了如何使用Nginx免费版与Keepalived实现高可用性(HA)方案,涵盖环境搭建、Keepalived安装配置、版本升级及主从模式设置。通过虚拟机测试,结合CentOS与宝塔,详细说明VIP配置与服务启动流程,助你构建稳定可靠的Web高可用架构。
|
10月前
|
JSON 前端开发 应用服务中间件
配置Nginx根据IP地址进行流量限制以及返回JSON格式数据的方案
最后,记得在任何生产环境部署之前,进行透彻测试以确保一切运转如预期。遵循这些战术,守卫你的网络城堡不再是难题。
392 3
|
安全 Shell Linux
内网渗透测试基础——Windows PowerShell篇
内网渗透测试基础——Windows PowerShell篇
760 0
|
存储 Shell 开发工具
8-8|windows上Git报错
8-8|windows上Git报错
|
Shell PHP Windows
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
【Azure App Service】Web Job 报错 UNC paths are not supported. Defaulting to Windows directory.
260 0
|
Java 开发工具 Spring
【Azure Spring Cloud】使用azure-spring-boot-starter-storage来上传文件报错: java.net.UnknownHostException: xxxxxxxx.blob.core.windows.net: Name or service not known
【Azure Spring Cloud】使用azure-spring-boot-starter-storage来上传文件报错: java.net.UnknownHostException: xxxxxxxx.blob.core.windows.net: Name or service not known
229 0
【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn
【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn
281 0
|
消息中间件 负载均衡 应用服务中间件
高并发环境下的Nginx整合方案
【8月更文挑战第20天】在高并发环境下,整合Nginx代理服务器、静态文件服务器、Tomcat集群、Mycat数据库读写分离和消息队列,可以构建一个强大、灵活且可扩展的Web服务架构。
264 1