#运行NGINX所使用的用户和组user www www; #NGINX进程数, it is recommended to follow the number of CPUs, generally according to its multiples, each process consumes about 10M of memory worker_processes 4; #日志信息error_log/usr/ Local/nginx/logs/error.log;pid/usr/local/nginx/logs/nginx.pid;worker_rlimit_nofile 65535;events {#使用epoll的I/O model Use Epoll; #该值守系统进程最大打开文件数限制, you need to use command ulimit-n to view worker_connections 65535;} HTTP {include mime.types; Default_type Application/octet-stream; Server_names_hash_bucket_size 128; Client_header_buffer_size 32k; Large_client_header_buffers 4 32k; Sendfile on; Keepalive_timeout 60; Tcp_nodelay on; Tcp_nopush on; #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; gzip on; Gzip_min_length 1k; Gzip_buffers 4 16k; Gzip_http_version 1.0; Gzip_comp_level 2; Gzip_types Text/plain ApplicatioN/x-javascript Text/css Application/xml; Gzip_vary on; server {Listen 80; server_name www.islowlife.net; # #root/home/webserver/website/islowlife/; # #index html/tindex.html; Location/{index html/tindex.html; root/home/webserver/website/islowlife/; } location ~.*\. (jsp|do|action) $ {proxy_pass http://localhost:8000; Proxy_set_header Host $host; Proxy_set_header X-real-ip $remote _addr; Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; } error_page 502 503 504/50x.html; Location =/50x.html {root html; }} server {listen 80; server_name image.zhuoyouapp.com; # #root/home/webserver/website/islowlife/; # #index html/tindex.html; Location ~ \. (Html|js|css|jpg|jpeg|png|gif|xml) $ {root/home/webserver/website/zy_part_1_v1/iosfile/softwareconfig/; Expires 30d; } location/{Proxy_pass http://localhost:8000; Proxy_set_header Host $host; Proxy_set_header X-real-ip $remote _addr; Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; } error_page 502 503 504/50x.html; Location =/50x.html {root html; }} server {listen 8081; server_name localhost; Location ~ \. (Html|js|css|jpg|jpeg|png|gif|xml) $ {root/home/webserver/website/; Expires 30d; } location/{Proxy_pass http://localhost:8001; Proxy_set_header Host $host; Proxy_set_header X-real-ip $remote _addr; Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; } error_page 502 503 504/50x.html; Location =/50x.html {root html; }} server {listen 8080; server_name localhost; Location ~ \. (html|js|css|jpg|jpeg|png|gif) $ {root/home/webserver/website/; Expires 30d; } location/{Proxy_pass http://localhost:8000; Proxy_set_header Host $host; Proxy_set_header X-real-ip $remote _addr; Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; } error_page 502 503 504/50x.html; Location =/50x.html {root html; }} server {listen 80; server_name 42.121.119.146; Location ~ \. (html|js|css|jpg|jpeg|png|gif) $ {root/home/webserver/website/; Expires 30d; } location/{Proxy_pass http://localhost:8000; Proxy_set_header Host $host; Proxy_set_header x-real-IP $remote _addr; Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for; } error_page 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$ {# ProX Y_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 # #l ocation ~/\.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; # } #}}
Nginx Configuration file Backup