## 1.路由代码中添加mode:'history'
~~~
const router = new Router({
mode: 'history', //去掉url中的#
~~~
## 2.在nginx的配置文件.conf中对应的路径下添加:try\_files $uri $uri/ /index.html;
~~~
server {
listen 80;
server_name my.vue.com;
charset utf-8;
location / {
root /Users/libo/Documents/workspace/Vue-me/my-project/dist;
index index.html index.htm index.php;
try_files $uri $uri/ /index.html;
}
location ^~ /ssm_project/ {
proxy_pass http://127.0.0.1:8081;
proxy_cookie_path /127.0.0.1:8081/ /;
proxy_pass_header Set-Cookie;
proxy_set_header Host 127.0.0.1:8081;
}
}
~~~
## 3.如果项目不在根目录下。例如,路径为 http://www.hahaha.com/static/index,还需要配置
3.1 config/index.js
```
modul