nginx反向代理两个网页
时间: 2023-11-15 07:56:23 浏览: 113
好的,您可以按照以下步骤来配置nginx反向代理两个网页:
1. 安装nginx:在Linux系统中,可以使用以下命令安装nginx:
```
sudo apt-get update
sudo apt-get install nginx
```
2. 配置nginx:打开nginx配置文件 `/etc/nginx/nginx.conf`,在 `http` 块中添加以下内容:
```
server {
listen 80;
server_name example.com;
location /web1/ {
proxy_pass http://localhost:8080/;
}
location /web2/ {
proxy_pass http://localhost:8081/;
}
}
```
其中,`example.com` 是您的域名,`/web1/` 和 `/web2/` 是您想要代理的两个网页的路径,`http://localhost:8080/` 和 `http://localhost:8081/` 是这两个网页的实际地址。
3. 重启nginx:使用以下命令重启nginx:
```
sudo service nginx restart
```
现在,您可以通过访问 `http://example.com/web1/` 和 `http://example.com/web2/` 来访问这两个网页了。
阅读全文
相关推荐


















