Nginx 项目部署和配置

nginx 作为代理服务器,需要代理多个项目的话配置如下:

[plain]view plaincopyprint?

  1. server {
  2. listen 80;
  3. server_name localhost;
  4. #charset koi8-r;
  5. #access_log /var/log/nginx/log/host.access.log main;
  6. location / {
  7. root /usr/local/tomcat/webapps/GW;
  8. index index.html index.htm;
  9. }
  10. location /HealthXX {
  11. proxy_pass http://10.24.1xx.1xx:8080/HealthPlatform; <span >(部署在tomcat上的web项目)</span>
  12. }
  13. location /SmartBankXX {
  14. <pre name="code" class="plain"> <span > </span> proxy_pass http://10.24.1xx.1xx:8080/SmartXX (部署在tomcat上的web项目)
server {
    listen       80;
    server_name  localhost;
#charset koi8-r;
#access_log  /var/log/nginx/log/host.access.log  main;

location / {
    root   /usr/local/tomcat/webapps/GW;
    index  index.html index.htm;
}

location /HealthXX {
proxy_pass http://10.24.1xx.1xx:8080/HealthPlatform; <span >(部署在tomcat上的web项目)</span>
}
location /SmartBankXX {
<pre name="code" class="plain"> <span > </span> proxy_pass http://10.24.1xx.1xx:8080/SmartXX (部署在tomcat上的web项目)
}

访问某个项目: http:// IP/HealthXX 即可