user pi; worker_processes auto; #worker_cpu_affinity 0001 0010 0100 1000; #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; multi_accept on; use epoll; } http { include mime.types; default_type application/octet-stream; sendfile on; access_log off; tcp_nopush on; tcp_nodelay on; # 数据在传输的过程中不进缓存 #keepalive_timeout 0; keepalive_timeout 10; client_header_timeout 10; client_body_timeout 10; reset_timedout_connection on; send_timeout 100; limit_conn_zone $binary_remote_addr zone=addr:5m; limit_conn addr 100; charset utf-8,gbk; proxy_buffers 8 1M; #proxy_buffer 4 32k; server_tokens off; server { listen 80; gzip on; gzip_min_length 200; gzip_buffers 32 4k; gzip_comp_level 5; client_max_body_size 500M; gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php; gzip_vary on; gzip_disable "MSIE [1-6]\."; root /var/www/html; location / { index index.html index.htm index.php; } location /gogs/ { proxy_pass http://127.0.0.1:3000/; } location /data/ { autoindex on; auth_basic "Input user name and password"; auth_basic_user_file /home/pi/.passwd; } location /gogsPics/{ autoindex on; } location /video/{ autoindex on; } location /photo/{ proxy_pass http://127.0.0.1:8008; } location /allPhotos/{ proxy_pass http://127.0.0.1:8008; } location /message/{ proxy_pass http://127.0.0.1:8005; } location /static/{ proxy_pass http://127.0.0.1:8008; } location /book/diary/ { autoindex on; auth_basic "Input user name and password"; auth_basic_user_file /home/pi/.passwd; } location /frps_monitor/ { proxy_pass http://zeekling.cn:7500/static/; } location /api/ { proxy_pass http://zeekling.cn:7500/api/; } location ~ .*\.(php|php5)?$ { fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 82; server_name book.zeekling.cn; gzip on; gzip_min_length 1k; gzip_buffers 4 32k; gzip_comp_level 5; gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php; gzip_vary on; gzip_disable "MSIE [1-6]\."; root /var/www/html/book; location / { index index.html index.htm; } location /diary/ { autoindex on; auth_basic "Input user name and password"; auth_basic_user_file /home/pi/.passwd; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } # another virtual host using mix of IP-, name-, and port-based configuration # server { listen 81; server_name www.zeek-pan.cn; gzip on; gzip_min_length 1k; gzip_buffers 4 32k; gzip_comp_level 5; gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php; gzip_vary on; gzip_disable "MSIE [1-6]."; client_max_body_size 500M; proxy_request_buffering off; location /files/ { proxy_pass http://127.0.0.1:8082/; } location ~* .html$ { index index.html index.htm; } location / { proxy_pass http://127.0.0.1:8000/; } } server { listen 443 ssl; gzip on; gzip_min_length 200; gzip_buffers 32 4k; gzip_comp_level 5; ssl_certificate /usr/local/nginx/conf/cert/www.crt; ssl_certificate_key /usr/local/nginx/conf/cert/www.key; client_max_body_size 500M; gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php; gzip_vary on; gzip_disable "MSIE [1-6]\."; root /var/www/html; location / { index index.html index.htm index.php; } location /gogs/ { proxy_pass http://127.0.0.1:3000/; } location /dowload/ { auth_basic "Input user name and password"; auth_basic_user_file /home/pi/.passwd; proxy_pass http://127.0.0.1:8080/; } location /data/ { autoindex on; auth_basic "Input user name and password"; auth_basic_user_file /home/pi/.passwd; } location /gogsPics/{ autoindex on; } location /video/{ autoindex on; } location /photo/{ proxy_pass http://127.0.0.1:8008; } location /allPhotos/{ proxy_pass http://127.0.0.1:8008; } location /message/{ proxy_pass http://127.0.0.1:8005; } location /static/{ proxy_pass http://127.0.0.1:8008; } location /neo4j/{ proxy_pass http://127.0.0.1:7474/; } location /book/diary/ { autoindex on; auth_basic "Input user name and password"; auth_basic_user_file /home/pi/.passwd; } location /frps_monitor/ { proxy_pass http://zeekling.cn:7500/static/; } location /api/ { proxy_pass http://zeekling.cn:7500/api/; } location /zabbix/ { proxy_pass http://192.236.147.196:8090/zabbix/; } location ~ .*\.(php|php5)?$ { fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } upstream backend { server localhost:8080; # Tomcat/Jetty 监听端口 } server { listen 80; server_name blog.zeekling.cn; gzip on; gzip_min_length 200; gzip_buffers 32 4k; gzip_comp_level 5; client_max_body_size 500M; gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php; gzip_vary on; gzip_disable "MSIE [1-6]\."; root /var/www/html; location / { proxy_pass http://backend$request_uri; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; server_name_in_redirect off; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 443; server_name blog.zeekling.cn; gzip on; gzip_min_length 200; gzip_buffers 32 4k; gzip_comp_level 5; ssl_certificate /usr/local/nginx/conf/cert/zeekling.crt; ssl_certificate_key /usr/local/nginx/conf/cert/zeekling.key; client_max_body_size 500M; gzip_types text/plain application/x-javascript application/javascript text/css application/xml text/javascript application/x-httpd-php; gzip_vary on; gzip_disable "MSIE [1-6]\."; root /var/www/html; location / { proxy_pass http://backend$request_uri; proxy_set_header Host $host:$server_port; proxy_set_header X-Real-IP $remote_addr; server_name_in_redirect off; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }