Win10
上的 Bash on Ubuntu
是个很好用的玩具,让windows开发环境下的人能无缝操练Linux,可是涉及到网络部分仍是有不少要该进的地方,好比Nginx
的安装就遇到了问题。html
sudo apt install nginxnginx
sudo service nginx startgit
报错: 大意端口没法绑定,关闭IIS或者修改nginx 端口为8080
依旧没法启动,而且bash中ps -ef
没法查看到端口状况github
查找github上的Bash on Windows 的issue,果真有人提这个问题,找了好一会解决了,https://github.com/Microsoft/BashOnWindows/issues/68, 具体以下windows
修改 /etc/nginx/nginx.conf, 添加配置(添加到第四行),浏览器
master_process off;bash
重启网络
sudo service nginx restartrest
注意不要添加配置 daemon off;
,它会致使nginx卡死,没法返回默认html页,服务也没法重启code
若是还不行就把配置中ip4和ip6的端口改为不一样的两个端口,再不行就去https://github.com/Supervisor/supervisor/issues 中寻找但愿了
nginx
启动后你在bash
中ps -ef
依旧没法查看道nginx的端口占用,可是sudo service nginx status
,能看到* nginx is running
,而且在window
的cmd
下使用netstat -an
能看到配置的8080
端口已被占用,也能在浏览器中访问127.0.0.1:8080
,问题虽有,可是做为我的开发环境仍是能够的.