服务的启动:启动nginx,并通过-c参数来指定服务所需用到的配置文件
nginx -c /etc/nginx/nginx.conf
服务的停止、重启
nginx -s reload
常见问题:
在windows的Linux子系统上,安装完nginx,会出现以下问题:
nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
原因就是启动nginx的时候,没有指定配置文件。
解决方法:找到你的nginx.conf的文件夹目录,然后运行类似如下命令
nginx -c /etc/nginx/nginx.conf
再运行nginx -s reload,就可以了。
api路由提示404
原文:https://www.cnblogs.com/zhaoxizhe/p/11827529.html