nginx 配置
token 认证方式
在 conf.d 目录下面新建 dwsurvey.conf,并配置如下内容
conf
server {
listen 80;
server_name _;
root /www/sf/dist;
index index.html;
location / {
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api {
# rewrite ^/api/(.*) /$1 break;
proxy_pass http://localhost:8899;
}
location /file {
# rewrite ^/api/(.*) /$1 break;
proxy_pass http://localhost:8899;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}编辑 nginx.conf 的配置引用 include /etc/nginx/conf.d/dwsurvey.conf; 如下所示
include /etc/nginx/conf.d/*.conf;效果如图

session 认证方式
在 conf.d 目录下面新建 dwsurvey.conf,并配置如下内容
conf
server {
listen 80;
server_name _;
root /www/sf/dist;
index index.html;
location / {
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}编辑 nginx.conf 的配置引用 include /etc/nginx/conf.d/dwsurvey.conf; 如下所示
include /etc/nginx/conf.d/*.conf;效果如图


