如何配置nginx以支持vue.js项目长尾词访问?

2026-04-06 19:011阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计217个文字,预计阅读时间需要1分钟。

如何配置nginx以支持vue.js项目长尾词访问?

nginxserver { listen 80; server_name example.com www.example.com;

location / { root /usr/share/nginx/; index index. index.htm; }}

nginx.conf

#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; charset utf-8; location ~ ^/{ root "D:/vue/myvue/dist/"; } location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ { root /static/; #expires定义用户浏览器缓存的时间为7天,如果静态页面不常更新,可以设置更长,这样可以 节省带宽和缓解服务器的压力 expires 7d; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }

如何配置nginx以支持vue.js项目长尾词访问?

本文共计217个文字,预计阅读时间需要1分钟。

如何配置nginx以支持vue.js项目长尾词访问?

nginxserver { listen 80; server_name example.com www.example.com;

location / { root /usr/share/nginx/; index index. index.htm; }}

nginx.conf

#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; charset utf-8; location ~ ^/{ root "D:/vue/myvue/dist/"; } location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ { root /static/; #expires定义用户浏览器缓存的时间为7天,如果静态页面不常更新,可以设置更长,这样可以 节省带宽和缓解服务器的压力 expires 7d; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }

如何配置nginx以支持vue.js项目长尾词访问?