# 新闻头条平台App端 **Repository Path**: primusmj/news-headline-platform-app-end ## Basic Information - **Project Name**: 新闻头条平台App端 - **Description**: 新闻头条平台App端 - **Primary Language**: HTML - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-11-01 - **Last Updated**: 2024-11-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 新闻头条平台-app静态页面端 后端项目地址:[https://gitee.com/rediaz/news-headline-platform](https://gitee.com/rediaz/news-headline-platform) ### 配置nginx 配置nginx.conf文件 在nginx安装的conf目录下新建一个文件夹`leadnews.conf`,在当前文件夹中新建`heima-leadnews-app.conf`文件 heima-leadnews-app.conf配置如下: ```javascript upstream heima-app-gateway{ server localhost:51601; } server { listen 8801; location / { root F:/Code/news-headline-platform-app-end/app-web; index index.html; } location ~/app/(.*) { proxy_pass http://heima-app-gateway/$1; proxy_set_header HOST $host; # 不改变源请求头的值 proxy_pass_request_body on; #开启获取请求体 proxy_pass_request_headers on; #开启获取请求头 proxy_set_header X-Real-IP $remote_addr; # 记录真实发出请求的客户端IP proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #记录代理信息 } } ``` nginx.conf 把里面注释的内容和静态资源配置相关删除,引入heima-leadnews-app.conf文件加载 ```javascript #user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; # 引入自定义配置文件 include leadnews.conf/*.conf; } ``` ④ :启动nginx ​ 在nginx安装包中使用命令提示符打开,输入命令nginx启动项目 ​ 可查看进程,检查nginx是否启动 ​ 重新加载配置文件:`nginx -s reload` ⑤:打开前端项目进行测试 -- > http://localhost:8801 ​ 用谷歌浏览器打开,调试移动端模式进行访问