Comments (16)
from hitchhiker.
在/etc/hitchhiker后面加上 /public 试试
from hitchhiker.
可以参考下我这个:
server {
listen 80;
server_name www.hitchhiker-api.com;
access_log /var/log/nginx/api_access.log;
location / {
limit_req zone=perip burst=5;
proxy_pass http://api;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static/ {
proxy_pass http://api;
root /my/hitchhiker/public;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
}
from hitchhiker.
用你的试了,好使,不过左上角的logo变了样子,索性不代理了 直接docker-compose的时候用了80端口,不然太麻烦了。
from hitchhiker.
logo变样子应该是svg没支持好,没其他服务的话不用代理也行,我是有个邮件服务在一起,所以用个nginx分发下
from hitchhiker.
@brookshi 要注意的是hitchhiker和nginx对主机的端口不能冲突。
你这个配置文件中 nginx的80 和 http://api 岂不是冲突了?
from hitchhiker.
@vmvz 是指docker里配置的端口,不然就会有两个程序共用一个端口了
from hitchhiker.
@brookshi 如果这样配置http://api
的话, 如何配置 docker-compose.yml
?
nginx起代理作用,居然可以反代 http://api
我不能理解, 我用Python的时候, 基本上都是 nginx 反代 ' http://api:8080'
from hitchhiker.
哦,http://api 其实是个简写来的,实际上是http://localhost:8080
from hitchhiker.
@tchroot 更换域名以后, 还是请求老的api, 有办法处理吗? http://old.domain:8080/api/user/temp
不好弄, 我就重新搞一个.
from hitchhiker.
@tchroot 我已经用nginx反代了, 每次请求api 还是去localhost
from hitchhiker.
host 需要 改成对外访问的,比如用的域名,docker-compose.yml里的host需要改成域名及端口,而不是localhost
from hitchhiker.
@brookshi 既然nginx配置分享了,顺便把 www.hitchhiker-api.com 部署的 docker-compose.yml 文件贴出来给我们参考吧
from hitchhiker.
@brookshi 今天折腾得我怀疑自己了.
docker部署
假设外网地址是 1.2.4.8 , 域名 www.a.com
简单说, 我已经和你的配置几乎一样了,除了域名不同,
访问 www.a.com 的时候, 首页正常打开, 但是注册或try without login的时候
控制台看到api还是调用这样的地址 http://1.2.4.8:8080/api/user/temp
最后我放弃了, 我用 http://1.2.4.8:8080/
这样的方式直接访问了, 反正又不是对外用的.
不过有空再次折腾一下试试.
(PS: nginx debian nodejs 部署我还是比较熟悉的,经验也不少呀)
from hitchhiker.
@vmvz 最关键的是HITCHHIKER_APP_HOST一定要是 http://www.a.com/ 因为应用启动后会找到main.js,用这个host替换掉里面的一个地址,也就是浏览器里看到了,你那里没替换掉,所以还是ip
from hitchhiker.
@brookshi 谢谢你耐心的解答.
我确定 HITCHHIKER_APP_HOST=http://www.a.com/
本地还用隐身模式,防止缓存
这么晚了,早点休息吧... 明天我再来一遍, 全部配置贴出来
from hitchhiker.
Related Issues (20)
- 压力测试运行时node端报$字符错误
- 2000条用例导致登录会消耗很长时间约1.5分钟 HOT 4
- docker安装无法发邮件 HOT 6
- 请问将服务器部署在阿里云上怎么进行本地调试?
- 负载均衡时Session过期问题
- 参数化数据类型丢失导致无法使用
- 在Collections目录下切换Environment无法立即生效
- body 请允许可以写 注释 HOT 1
- 启动连接11010 端口失败?
- 接口返回http code 为 500时,自动化测试认为失败了
- 文档页面打不开了
- linux系统部署Hitchhiker有部署文档的链接吗,https://github.com/brookshi/Hitchhiker/blob/master/doc/howtoinstall-linux-cn.md 这个链接报404 HOT 1
- docker部署,创建账户后,报sql错误:[2019-05-06 09:47:50.369] [ERROR] console - Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'json NOT NULL, createDate datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), `' at line 1
- 部署成功后,谷歌浏览器点击不登录试用或者直接注册,都会调到一个页面但是资源加载不出来,看console下有报错403 HOT 5
- 请问这个项目还在维护和更新吗?
- JavaScript heap out of memory
- 脚本执行顺序
- collection级别脚本修改url时,会清空hitchhiker.request
- 怎么用js获取当前环境的IP? HOT 1
- 用“raw”模式 post 成功后,返回内容在“内容”页签没有输出,但切换为“x-www-form-urlencoded”时会重放打印“raw”的响应内容
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hitchhiker.