Home  >  Q&A  >  body text

nginx all pages point to index.html

nginx How to point all pages to index.html in a directory. For example, when I visit /aa/ and /aa/aa/ /cc/
they all point to a file

高洛峰高洛峰2712 days ago705

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 17:16:04

    This has nothing to do with nginx. nginx sets a forwarding address, and then the wsgi server listening to this address can point the route you want to the file you want to go to.

    reply
    0
  • ringa_lee

    ringa_lee2017-05-16 17:16:04

    In the directory /path/to/html放个文件hello.html,
    is configured as follows:

    server {
        listen 4080;
        location / {
            try_files '' /path/to/html;
        }
        location = /hello.html {
            root /path/to/html;
        }
    }

    reply
    0
  • Cancelreply