Nginx 实现 前后端分离开发
1、下载Nginx稳定版本
2、打开nginx配置文件 nginx.conf;
3、在http模块的server部分配置
server { listen 80; // Nginx的监听端口 server_name localhost; // 访问Nginx服务器的域名
location / { root /home/bucai/wwwroot; // 前端项目入口文件的路径 index index.html index.htm; // 前端入口文件为index.html } location /api { // 凡是以/api开头的http请求都会被下面的服务器处理 proxy_pass https://127.0.0.1:8080; // 被代理的服务器的域名 }
}
以上就是关于nginx反向代理的知识。
有关于nginx其他方面的知识以后再记录吧。