Nginx config

来自WHY42
Riguz留言 | 贡献2024年12月7日 (六) 03:21的版本 →‎Reverse proxy

Configuration

Serve React

Note:

  • Solve browser route 404:[1]
server {
    root /var/www/html;
    server_name yai.ink;

    location / {
        try_files $uri $uri/ /index.html;
    }
}

Reverse proxy

Note: be careful that the backend should also use correct config.

server {
    index index.html index.htm index.nginx-debian.html;
    
    server_name yai.ink;

    location / {
        proxy_pass http://localhost:8000;
    }
}