user nginx;
worker_processes auto;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 10240;
}
virtual host
http {
log_format main ‘$remote_addr $remote_user [$time_local] “$request” $http_host ‘
‘[$status] [$upstream_status] [$body_bytes_sent] “$http_referer” ‘
‘“$http_user_agent” $ssl_protocol $ssl_cipher $upstream_addr ‘
‘[$request_time] [$upstream_response_time]’;
access_log /dev/stdout main;
upstream haha{
server 192.168.99.225:80 max_fails=2 fail_timeout=30s;
}
upstream hehe{
server 192.168.99.232:80 max_fails=2 fail_timeout=30s;
}
server {
listen 80;
server_name a.com;
location / {
root html;
index index.html index.htm;
}
location /nginx_status {
stub_status on;
access_log off;
}
location ^/(haha) {
proxy_pass http://haha/haha.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location ^~ /hehe {
proxy_pass http://hehe/hehe.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log /mnt/log/nginx/main_access.log main;
}
}