一份完整的nginx配置

#user nobody;
worker_processes 24;
worker_rlimit_nofile 262144;
worker_cpu_affinity 000000000000000000000001 000000000000000000000010 000000000000000000000100 000000000000000000001000 000000000000000000010000 000000000000000000100000 000000000000000001000000 000000000000000010000000 000000000000000100000000 000000000000001000000000 000000000000010000000000 000000000000100000000000 000000000001000000000000 000000000010000000000000 000000000100000000000000 000000001000000000000000 000000010000000000000000 000000100000000000000000 000001000000000000000000 000010000000000000000000 000100000000000000000000 001000000000000000000000 010000000000000000000000 100000000000000000000000;

pid /var/run/nginx.pid;
events {
use epoll;
multi_accept on;
worker_connections 10000;
}

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

http {
include mime.types;
default_type application/octet-stream;

log_format main '$time_local|$upstream_response_time|$request_time|$status|$http_referer|$request|$http_user_agent|$upstream_addr|$http_x_forwarded_for|$request_body';
#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

upstream pap_backend_conf {
keepalive 128;
server 127.0.0.1:9221 max_fails=2 fail_timeout=5 weight=100;
server 10.110.94.152:9221 max_fails=2 fail_timeout=5 weight=100;
server 10.110.94.152:9220 max_fails=2 fail_timeout=5 weight=100;
}
server {
listen 9220;
server_name _;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
access_log /letv/logs/nginx/access.log main;
error_log /letv/logs/nginx/error.log;
proxy_pass http://pap_backend_conf;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


#user nobody;
worker_processes 24;
worker_rlimit_nofile 262144;
worker_cpu_affinity 000000000000000000000001 000000000000000000000010 000000000000000000000100 000000000000000000001000 000000000000000000010000 000000000000000000100000 000000000000000001000000 000000000000000010000000 000000000000000100000000 000000000000001000000000 000000000000010000000000 000000000000100000000000 000000000001000000000000 000000000010000000000000 000000000100000000000000 000000001000000000000000 000000010000000000000000 000000100000000000000000 000001000000000000000000 000010000000000000000000 000100000000000000000000 001000000000000000000000 010000000000000000000000 100000000000000000000000;

pid /var/run/nginx.pid;
events {
use epoll;
multi_accept on;
worker_connections 10000;
}

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

http {
include mime.types;
default_type application/octet-stream;

log_format main '$time_local|$upstream_response_time|$request_time|$status|$http_referer|$request|$http_user_agent|$upstream_addr|$http_x_forwarded_for|$request_body';
#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

upstream pap_backend_conf {
keepalive 128;
server 127.0.0.1:9221 max_fails=2 fail_timeout=5 weight=100;
server 10.110.94.152:9221 max_fails=2 fail_timeout=5 weight=100;
server 10.110.94.152:9220 max_fails=2 fail_timeout=5 weight=100;
}
server {
listen 9220;
server_name _;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
access_log /letv/logs/nginx/access.log main;
error_log /letv/logs/nginx/error.log;
proxy_pass http://pap_backend_conf;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

转载于:https://www.cnblogs.com/coding4/p/5853989.html

你可能感兴趣的:(运维,php,epoll)