将http://172.30.203.129:4850/ 通过nginx代理变成textocr-uat.sunwoda.com访问
时间: 2023-12-13 09:03:22 浏览: 35
要将 `http://172.30.203.129:4850/` 通过 Nginx 代理变成 `textocr-uat.sunwoda.com` 访问,你可以按照以下步骤进行操作:
1. 确保你已经将 `textocr-uat.sunwoda.com` 这个域名解析到了正确的 IP 地址上。这可以通过在 DNS 设置中添加一个 A 记录来完成。
2. 安装和配置 Nginx。确保你已经安装了 Nginx 并且正确配置了其基本设置。
3. 创建一个新的服务器块或编辑默认服务器块的配置文件。可以在 Nginx 配置文件的 `sites-available` 目录中创建一个新的配置文件,或者直接编辑默认配置文件。
4. 在服务器块中添加以下内容来配置反向代理:
```nginx
server {
listen 80;
server_name textocr-uat.sunwoda.com;
location / {
proxy_pass http://172.30.203.129:4850/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
5. 保存并退出配置文件,然后重新加载 Nginx 配置以应用更改。
6. 检查防火墙设置,确保允许通过所选端口的流量。
7. 最后,在浏览器中访问 `http://textocr-uat.sunwoda.com`,应该能够通过域名访问 `http://172.30.203.129:4850/` 的内容了。
如果你的系统使用 HTTPS,还需要在 Nginx 配置中添加 SSL 证书的相关设置。