-
win10安装nginx的配置和使用方法>1)下载nginx软件
官方下载地址:http://nginx.org/en/download.html
2)解压缩软件
unzip nginx-1.20.1.zip 或者 使用解压缩软件,下面是解压缩后的内容
3)CMD命令行启动nginx
cd nginx-1.20.1
start nginx
nginx -t
tasklist /fi “imagename eq nginx.exe”
nginx -s reload //重新加载
nginx -s stop //此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程
nginx -s quit //此方式停止步骤是待nginx进程处理任务完毕进行停止
说明:
解压的Nginx路径不能有中文,否则启动不起来
在命令窗口启动后会有各弹窗一闪而逝,不用管他
start nginx:为启动命令
nginx -t 为启动状态检查命令
4)测试、访问
正常80端口不被占用的情况下,url输入: localhost,页面显示:
5)配置两个服务的代码
server {
listen 80;
server_name localhost;
location / {
root html/default;
index index.html index.htm;
}
}
#set port
server {
listen 8001;
server_name localhost;
location /{
root html/demo;
index index.html index.htm;
}
}
回顶部