赞
踩
用这份配置之前,用了官方提供的 try_files $uri $uri/ /;,出现了一个致命问题,就是非当前页(跳新标签)与刷新页面时,会先跳首页,再出现对应页面
用于nuxtjs 启动项目,使用nginx反向代理至80端口
进入nginx配置文件目录
cd /usr/local/nginx/conf/conf.d
创建配置文件
touch nuxt.conf
写入配置
map $sent_http_content_type $expires { "text/html" epoch; "text/html; charset=utf-8" epoch; default off; } server { listen 80; # the port nginx is listening on server_name localhost; # setup your domain here gzip on; gzip_types text/plain application/xml text/css application/javascript; gzip_min_length 1000; location / { expires $expires; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 1m; proxy_connect_timeout 1m; proxy_pass http://127.0.0.1:3001; # set the address of the Node.js instance here } }
重启nginx
nginx -s reload
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。