Nginx配置文件

user www www;
worker_processes 8;             #有多少CPU核,就用多少个进程,worker进程的数量会直接影响性能.
error_log /logs/web/nginx.error.log;
pid /var/run/nginx.pid;
events {
worker_connections 4096;
multi_accept on;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
proxy_ignore_client_abort on;
fastcgi_ignore_client_abort on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_buffers 2 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
client_max_body_size 500M;
client_body_buffer_size 1024k;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
log_format postdata '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_time" $request_body';
log_format public_jsonlog '{"@timestamp": "$time_iso8601",'
'"remote_addr": "$remote_addr",'
'"real_host": "$http_x_forwarded_for",'
'"http_host": "$http_host",'
'"request_method": "$request_method",'
'"request_uri": "$request_uri",'
'"uri": "$uri",'
#'"request_args": "$query_string",'
'"status": $status,'
'"bytes": $body_bytes_sent,'
'"agent": "$http_user_agent",'
'"up_resp_time": "$upstream_response_time",'
'"request_time": "$request_time"'
'}';
log_format service_jsonlog '{"@timestamp": "$time_iso8601",'
'"remote_addr": "$remote_addr",'
'"real_host": "$http_x_forwarded_for",'
'"http_host": "$http_host",'
'"request_method": "$request_method",'
'"request_uri": "$request_uri",'
'"uri": "$arg__url",'
#'"request_args": "$query_string",'
'"status": $status,'
'"bytes": $body_bytes_sent,'
'"agent": "$http_user_agent",'
'"up_resp_time": "$upstream_response_time",'
'"request_time": "$request_time"'
'}';
access_log /logs/web/nginx.access.log public_jsonlog;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
location / {
root /data/website;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php {
root /data/website;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
client_max_body_size 100M;
client_body_buffer_size 1024k;
}

server {
listen 443 ssl;
server_name localhost;
access_log /logs/web/nginx.log
ssl_certificate /usr/local/nginx/conf/ssl/xxx.pem;
ssl_certificate_key /usr/local/nginx/conf/ssl/xxx.pem;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
root /data/website;
index index.html index.htm index.php;
location ~ \.php$ {
root /data/website;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}


}
include /usr/local/nginx/conf/vhost/*.conf;
}

posted @ 2020-12-26 21:30  Buster_Hsueh  阅读(92)  评论(0编辑  收藏  举报