往nginx。conf的指定位置 添加新的内容

zou79189747 2014-01-15 11:40:55
开始配置文件内容:


worker_processes 1;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;


sendfile on;

keepalive_timeout 65;


server {
listen 80;
server_name localhost;

location / {
root html;
index index.html index.htm;
}
location ~ ^/host1/ {
rewrite ^/host1/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8080;
}


error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}
server {
listen 81;
server_name localhost;

location / {
root html;
index index.html index.htm;
}
location ~ ^/host1/ {
rewrite ^/host1/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8080;
}


error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}



}
我希望达到的效果是


worker_processes 1;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;


sendfile on;

keepalive_timeout 65;


server {
listen 80;
server_name localhost;

location / {
root html;
index index.html index.htm;
}
location ~ ^/host1/ {
rewrite ^/host1/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8080;
}
location ~ ^/host2/ {
rewrite ^/host2/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8080;
}



error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}
server {
listen 81;
server_name localhost;

location / {
root html;
index index.html index.htm;
}
location ~ ^/host1/ {
rewrite ^/host1/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8080;
}


error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}



}
麻烦 大神 们看看
...全文
173 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
teemai 2014-01-20
  • 打赏
  • 举报
回复
我记得这个你好像问过啊
zou79189747 2014-01-20
  • 打赏
  • 举报
回复
来个人回答 就送100分啊 我好结贴
zou79189747 2014-01-15
  • 打赏
  • 举报
回复
怎么还是没人回答、、、
zou79189747 2014-01-15
  • 打赏
  • 举报
回复
怎么没人回答 啊 就是文件读写啊 求帮组啊

51,397

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧