最近碰到一个棘手的问题,开发打包都没问题,发到线上页面不出来报错:
Uncaught SyntaxError: Invalid or unexpected token
,为了方便调试于是使用nginx
起本地服务,记录一下nginx
的简单配置
- 常用命令放在前面(windows没有配置
nginx
全局环境变量的话需要到nginx
的解压目录下运行命令)
- 启动:
start nginx
、nginx
- 停止:
nginx -s stop
、nginx -s quit
- 重启:
nginx -s reload
- 创建
nginx.pid
文件:nginx -c conf/nginx.conf
。这条命令在使用停止启动命令报nginx报错[error] CreateFile()
使用
- 下载与启动
- 下载地址https://nginx.org/en/download.html,页面有
Mainline version
(主版本)、Stable version
(稳定版本)、Legacy versions
(旧版本)可以下载。文章下载是稳定版,版本是nginx-1.20.1
- 将下载的压缩包解压到某个文件夹下
- 启动
-
<