Skip to content

想设置到二级路径下,请教下大佬,如果用nginx的话该怎么设置? #76

Closed Answered by BaoXuebin
zweie asked this question in Q&A
Discussion options

You must be logged in to vote

目前静态文件的二级路由是 /web/ 都会自动跳转至 /web, 你可以按照下面配置:

location ~ ^/(web|api) {
    proxy_pass http://127.0.0.1:10000;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header REMOTE-HOST $remote_addr;
    add_header X-Cache $upstream_cache_status;
    # cache
    add_header Cache-Control no-cache;
    expires 12h;
}

访问 http://your_domain.com/web。


如果支持配置二级域名,可以按下面的方式配置:

server {
    listen 80;
    server_name beancount.your_domain.com;

    location / {
        proxy_pass http://127.0.0.1:10000;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_for…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@zweie
Comment options

@BaoXuebin
Comment options

Answer selected by zweie
@BaoXuebin
Comment options

@zweie
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants