nginx 配置静态文件访问
期望访问 http://www.demo.com/en 可以代理到指定目录下的 index.html
linux 目录
nginx配置
rewrite 静态文件访问
xshell配置
nginx配置
server { listen 443 ssl; #监听端口 listen 80; #监听端口 server_name www.demo.com; #请求域名 ssl on; #开启ssl ssl_certificate /etc/nginx/cert/stationdm.com.pem; #pem证书路径 ssl_certificate_key /etc/nginx/cert/stationdm.com.key; #pem证书key路径 ssl_session_timeout 5m; #会话超时时间 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #加密算法 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #SSL协议 #重写静态资源跳转路径 rewrite ^/login/google/(.*) http://192.168.1.189:8081/login/google/$1 permanent; location /en { alias /opt/dezhou/en; index index.html; } location /ja { alias /opt/dezhou/ja; index index.html; } location /login/google/ { proxy_pass http://localhost:28099/login/google/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
vue静态文件无法访问解决
# ---------- Static Files ---------- # location /idm/loginbox { index index.htm index.html; alias /var/www/idm/loginbox; try_files $uri $uri/ /idm/loginbox/index.html; if ($request_filename ~* .*.(?:htm|html)$) { add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate"; } }
上一篇:
IDEA上Java项目控制台中文乱码