nginx转发url和映射本地资源
nginx的基本转发和映射配置 一. nginx转发url server {listen 80;server_name localhost;l
nginx的基本转发和映射配置
一. nginx转发url
server {listen 80;server_name localhost;location / {root html;index index.html index.htm;}# 配置将 `http://127.0.0.1:80/test1` 转发至 `http://127.0.0.1:8080`location /test1 {proxy_pass http://127.0.0.1:8080/; # 需要转发的url地址index index.html index.htm;}}
二.nginx映射本地静态资源
server {listen 80;server_name localhost;location / {root html;index index.html index.htm;}# 配置映射本地资源:本地路径 `E:/temp/`,访问地址 `http://127.0.0.1:80/image/图片名称(包含后缀)`location /image/ {root E:/temp/; #静态资源的本地目录rewrite ^/image/(.*)$ \$1 break;}}
版权声明
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处。如若内容有涉嫌抄袭侵权/违法违规/事实不符,请点击 举报 进行投诉反馈!