user www www; worker_processes 5; error_log logs/error.log; pid logs/nginx.pid; worker_rlimit_nofile 8192; events { worker_connections 4096;} http { include conf/mime.types; include /etc/nginx/proxy.conf; include /etc/nginx/fastcgi.conf; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $status ''"$request" $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; tcp_nopush on; server_names_hash_bucket_size 128;# this seems to be required for some vhosts server {# php/fastcgi listen 80; server_name domain1.com www.domain1.com; access_log logs/domain1.access.log main; root html; location /{ index index.html index.htm index.php;} location ~ \.php$ { fastcgi_pass 127.0.0.1:1025;}} server {# simple reverse-proxy listen 80; server_name domain2.com www.domain2.com; access_log logs/domain2.access.log main;# serve static files location ~^/(images|javascript|js|css|flash|media|static)/{ root /var/www/virtual/big.server.com/htdocs; expires 30d;}# pass requests for dynamic content to rails/turbogears/zope, et al location /{ proxy_pass http://127.0.0.1:8080;}} upstream big_server_com { server 127.0.0.3:8000 weight=5; server 127.0.0.3:8001 weight=5; server 192.168.0.1:8000; server 192.168.0.1:8001;} server {# simple load balancing listen 80; server_name big.server.com; access_log logs/big.server.access.log main; location /{ proxy_pass http://big_server_com;}}}
proxy_conf
proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffers 324k;
fastcgi_conf
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; fastcgi_index index.php; fastcgi_param REDIRECT_STATUS 200;
mime_types
types { text/html html htm shtml; text/css css; text/xml xml rss; image/gif gif; image/jpeg jpeg jpg; application/x-javascript js; text/plain txt; text/x-component htc; text/mathml mml; image/png png; image/x-icon ico; image/x-jng jng; image/vnd.wap.wbmp wbmp; application/java-archive jar war ear; application/mac-binhex40 hqx; application/pdf pdf; application/x-cocoa cco; application/x-java-archive-diff jardiff; application/x-java-jnlp-file jnlp; application/x-makeself run; application/x-perl pl pm; application/x-pilot prc pdb; application/x-rar-compressed rar; application/x-redhat-package-manager rpm; application/x-sea sea; application/x-shockwave-flash swf; application/x-stuffit sit; application/x-tcl tcl tk; application/x-x509-ca-cert der pem crt; application/x-xpinstall xpi; application/zip zip; application/octet-stream deb; application/octet-stream bin exe dll; application/octet-stream dmg; application/octet-stream eot; application/octet-stream iso img; application/octet-stream msi msp msm; audio/mpeg mp3; audio/x-realaudio ra; video/mpeg mpeg mpg; video/quicktime mov; video/x-flv flv; video/x-msvideo avi; video/x-ms-wmv wmv; video/x-ms-asf asx asf; video/x-mng mng;}
相关推荐
nginx负载均衡配置文件实例:基本配置说明文档和一个配置好的nginx.conf文件实例
主要介绍了Nginx DNS resolver配置实例,本文讲解在proxy_pass 和 upstream server 通信的时候需要手动指定 resolver,本文就给出了配置实例,需要的朋友可以参考下
Nginx+tomcat配置集群负载均衡实现动静分离实例
Nginx官网配置.pdf Nginx基本配置.pdf Nginx模块.pdf Nginx指南.pdf 第1章 Nginx简介.pdf 第2章 Nginx服务器的安装与配置.pdf 第3章 Nginx的基本配置与优化.pdf 第4章 Nginx与PHP(FastCGI)的安装、配置与优化.pdf 第...
第1章 Nginx简介 第2章 Nginx服务器的安装与配置 第3章 Nginx的基本配置与优化 第4章 Nginx与PHP(FastCGI)的安装、配置与优化 ...第7章 Nginx的Rewrite规则与实例 第8章 Nginx模块开发 ..........................
7.5. 可以将代理配置单独放在一个配置文件中 8. nginx的负载均衡(自学) 8.1. 什么是负载均衡 8.2. 负载均衡的优点 8.3. 负载均衡的分配策略 8.4. 负载均衡配置 9. 安装PHP 10. PHP-FPM 10.1. 什么是PHP-FPM ...
09.nginx配置实例(反向代理实例一) 10.nginx配置实例(反向代理实例二) 11.nginx配置实例(负载均衡) 12.nginx配置实例(动静分离准备工作) 13.nginx配置实例(动静分离) 14.nginx配置实例(高可用准备...
主要介绍了Nginx 多站点配置实例详解的相关资料,需要的朋友可以参考下
因为不想自己单独去申请域名证书和域名配置,便想到了这个方案,结合Nginx的location功能实现了自己的需求,便记录下来。示例中是以PHP的项目演示,其他的语言类似同样的方式进行部署。例如node的项目,可以在...
使用nginx+eureka实现微服务的高负载均衡,提高网站的访问性能
这个时候就需要简单的做一下目录映射来解决,比如想通过浏览器http://huoche.7234.cn/images/jb51/4n5r2x2bwa2.jpg访问到系统目录/image_data/2016/04/29/10/abc.jpg需要在nginx.conf中对应的server {}下添加...
conf/nginx.conf 为配置文件实例 RTMP监听 1935 端口,启用live 和hls 两个application HTTP监听 8080 端口, * :8080/stat 查看stream状态 * :8080/index.html 为一个直播播放与直播发布测试器 * :8080/vod....
第2章 Nginx服务器的安装与配置 第3章 Nginx的基本配置与优化 第4章 Nginx与PHP(FastCGI)的安装、配置与优化 第5章 Nginx与JSP、ASP.NET、Perl的安装与配置 第6章 Nginx HTTP负载均衡和反向代理的配置与优化 第7章 ...
4.6 在不停止Nginx服务的情况下平滑变更Nginx配置 4.7 编写每天定时切割Nginx日志的脚本 第5章 Nginx与JSP、 ASP.NET、 Perl的安装与配置 5.1 Nginx与JSP( Tomcat) 在Linux上的安装、 配置 5.2 Nginx与ASP.NET( ...
实战nginx.pdf。主要内容包括:第1章 Nginx简介;...第7章Nginx 的rewrite规则与实例;第8章 Nginx 模块开发;第9章Nginx 的web缓存服务与新浪网的开源NCACHE模块;第10章Nginx 在国内知名网站中的应用案例..........
4.6 在不停止Nginx服务的情况下平滑变更Nginx配置 4.7 编写每天定时切割Nginx日志的脚本 第5章 Nginx与JSP、ASP.NET、Perl的安装与配置 5.1 Nginx与JSP(Tomcat)在Linux上的安装、配置 5.2 Nginx与ASP.NET(Mono+...
Nginx配置文件的对应模块及模块属性详细说明。此外,还有一个实例帮助更好的了解Nginx配置