引言
由于目前工作不是特别忙,也就抽出了一些时间来整理一下有关nginx这个服务器的一些配置。
正文
#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;
sendfile on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
#fanxiangdaili
upstream local_8080 {
server 127.0.0.1:8081;
server 127.0.0.1:8082;
}
upstream local_8081 {
server 127.0.0.1:8083;
}
#fuzahijunheng
upstream myServer {
#ip_hash;
server 127.0.0.1:8080;
server 127.0.0.1:8081;
server 127.0.0.1:8082;
#server 127.0.0.1:8080 weight=10;
#server 127.0.0.1:8081 weight=5;
#server 127.0.0.1:8082 weight=5;
#server 127.0.0.1:8083 down;
}
server {
listen 80;
server_name localhost;
location / {
root /home/ftpuser/www;
index index.html index.htm;
}
location ~ \.jsp$ {
proxy_pass http://myServer;
}
location ~ ^/WEB_INF/ {
deny all;
}
}
server {
listen 80;
server_name 8080.local.com;
location / {
proxy_pass http://local_8080;
}
}
server {
listen 80;
server_name 8081.local.com;
location / {
proxy_pass http://local_8081;
}
}
}
至于其中配置的具体含义,我就没有再去添加文字去解释,目的就是这样大家使用可以直接贴走,不用再去删除一些配置。