博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[Nginx] Configuration for SPA
阅读量:4353 次
发布时间:2019-06-07

本文共 902 字,大约阅读时间需要 3 分钟。

server {    listen 0.0.0.0:80;    listen [::]:80;    default_type application/octet-stream;    gzip                    on;    gzip_comp_level         6;    gzip_vary               on;    gzip_min_length         1000;    gzip_proxied            any;    gzip_types              text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;    gzip_buffers            16 8k;    client_max_body_size    256M;    root /usr/share/nginx/html;    location / {        try_files $uri $uri/ /index.html =404;    }}

 

The highlighted part is important, without this, if you hint the page url:

http://localhost:8080/orders/1

It will show 404 page, because it will be regareded as a server request.

 

With this line of code, it will return index.html, then Frontend framework can handle with the router.

转载于:https://www.cnblogs.com/Answer1215/p/10732854.html

你可能感兴趣的文章
利用套接字实现进程通信一例
查看>>
linux中shell变量$#,$@,$0,$1,$2的含义解释
查看>>
常用的shell命令整理
查看>>
A Brief Introduction to the Design of UBIFS
查看>>
了解你的Linux系统:必须掌握的20个命令
查看>>
js setInterval 启用&停止
查看>>
knockoutJS学习笔记04:监控属性
查看>>
Linux下启动/关闭Oracle
查看>>
session和cookie的区别
查看>>
oracle 数据库、实例、服务名、SID
查看>>
web.xml文件的作用
查看>>
linux下oracle调试小知识
查看>>
alert弹出窗口,点击确认后关闭页面
查看>>
oracle问题之数据库恢复(三)
查看>>
单点登陆(SSO)
查看>>
HR,也确实“尽职尽责”
查看>>
MaxComputer 使用客户端配置
查看>>
20190823 顺其自然
查看>>
阅读《余生有你,人间值得》有感
查看>>
每日英语
查看>>