-
添加配置
cd /etc/nginx/conf.d vi api.conf
-
找到server修改配置文件如下
server{ server_name walking.example.com; location / { try_files $uri $uri/ /index.html; root /www/server/webapps/brisk_walking_backstage; index index.html index.htm index.php; } } server{ listen 80; server_name example.com; location / { proxy_pass http://127.0.0.1:8083; } }
-
保存配置 重启nginx
-
访问 example.com 就会访问8083端口
访问walking.example.com 就会访问brisk_walking_backstage应用
nginx使用子域名访问指定端口
最新推荐文章于 2024-07-24 10:59:17 发布