dpkg -l | grep zlib
sudo apt-get install openssl libssl-dev
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install zlib1g-dev
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
}
server {
listen 80;
server_name 192.168.68.134;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html-134;
index index.html index.htm;
}
}
server {
listen 80;
server_name 192.168.68.132;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html-132;
index index.html index.htm;
}
}
server {
listen 80;
server_name www.huangyueran1.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html-132;
index index.html index.htm;
}
}
server {
listen 80;
server_name www.huangyueran2.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html-134;
index index.html index.htm;
}
}
#反向代理 两个不同端口的tomcat;
upstream tomcatserver1 {
server 192.168.68.132:8080;
}
upstream tomcatserver2 {
server 192.168.68.132:8081;
}
server {
listen 80;
server_name 8080.huangyueran.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://tomcatserver1;
index index.html index.htm;
}
}
server {
listen 80;
server_name 8081.huangyueran.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://tomcatserver2;
index index.html index.htm;
}
}
#负载均衡
upstream tomcatserver {
server 192.168.68.132:8080 weight=5;
server 192.168.68.132:8081 weight=1;
}
server {
listen 80;
server_name 80.huangyueran.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://tomcatserver;
index index.html index.htm;
}
}
}