Windows上安装部署多个Nginx
安装
解压缩到两个文件夹下:
e.g. D:\Programs\nginx 和 D:\Programs\nginx-test
配置
在D:\Programs\nginx\conf下的nginx.conf文件
server {
listen 8088;
server_name localhost;
location / {
root html;
index index.html;
}
error_log logs/error_8088.log; # 独立错误日志
access_log logs/access_8088.log; # 独立访问日志
}
在D:\Programs\nginx-test\conf下的nginx.conf文件
server {
listen 8089;
server_name localhost;
location / {
root html;
index index.html;
}
error_log logs/error_8089.log; # 独立错误日志
access_log logs/access_8089.log; # 独立访问日志
}
启动
cd D:\Programs\nginx
start nginx
cd D:\Programs\nginx-test
start nginx
启动脚本(可选)
新建一个 start_all_nginx.bat
@echo off
cd /d D:\Programs\nginx
start nginx
cd /d D:\Programs\nginx-test
start nginx
访问验证
http://localhost:8088 → 显示 nginx 欢迎页
http://localhost:8089 → 显示另一个 nginx-test 的欢迎页

浙公网安备 33010602011771号