Public Repository

Last pushed: 2 years ago
Short Description
iUbuntu
Full Description

Tag:tomcat6_admin

  • 管理帳密:admin / admin
  • 部屬指令:docker run -d -p 8080:8080 pjhsiao/ubuntu:tomcat6_admin

說明:

Tomcat default run on port 8080

run -d will run in "detached" mode, in the background

run -p Publish a container's port to the host 8080:8080


Tag:nginx_load_balance

  • 部屬指令:docker run -t -i -p 8080:80 dockerfile/nginx bash

說明:

這裡Nginx主要用來做 load balancer

Nginx default run on port 80

run -t Allocate a pseudo-TTY

run -i Keep STDIN open even if not attached

  • 運行的容器中修改 nginx settings:vi /etc/nginx/sites-available/default

  # Default server configuration
  # 手動加入upstream 和 tomcat server address
   upstream tomcat_cluster {
   #tomcat server address for cluster
   server 192.168.0.1:8082; # 加入要叢集的tomcat server address
   server 192.168.0.1:8083; # 加入要叢集的tomcat server address
   }
server {
listen 80 default_server;
listen [::]:80 default_server;

.......略

server_name tomcat_cluster;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
           proxy_pass http://tomcat_cluster; #【use upstream name】
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;
}
.......略
  • check nginx config:sudo service nginx configtest
  • run nginx :sudo service nginx restart
  • 參考網址

Docker Command Line

Docker Hub nginx

How To Set Up Nginx Load Balancing

Docker Pull Command
Owner
pjhsiao

Comments (0)