• 主页
  • Java SE
  • J2ME
  • Web开发
  • Java EE
  • Eclipse
zou79189747 绍兴文理学院 2014年01月15日
往nginx。conf的指定位置 添加新的内容
开始配置文件内容:


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;
}

}



}
麻烦 大神 们看看
...全文
81 点赞 收藏 4
写回复
4 条回复

还没有回复,快来抢沙发~

发动态
发帖子
Java
创建于2007-09-28

1.7w+

社区成员

8.1w+

社区内容

Java相关技术讨论
社区公告
暂无公告