本案例有用过可行 0、先要在域名官网上面配置域名对应的IP地址,然后要在自己路由器上面将80端口映射到要装nginx服务器的IP地址。 1、从官网上面下载nginx1.6.2 WINDOWS版本的。访问地址http://nginx.org/en/download.html 2、解压缩到C盘根目录下面 3、复制C:\nginx\conf\nginx.conf,保存成一个副本 4、编辑nginx.conf,内容如下 #工作进程数,建议设置为CPU的总核数worker_processes 2; #全局错误日志定义类型,日志等级从低到高依次为: #debug | info | notice | warn | error | crit error_log logs/error.log info; #记录主进程ID的文件 pid /nginx/nginx.pid; #一个进程能打开的文件描述符最大值,理论上该值因该是最多能打开的文件数除以进程数。 #但是由于nginx负载并不是完全均衡的,所以这个值最好等于最多能打开的文件数。 #LINUX系统可以执行 sysctl -a | grep fs.file 可以看到linux文件描述符。 worker_rlimit_nofile 65535; #连接数上限, 单个进程允许的最大连接数 events { worker_connections 65535; } #设定http服务器,利用它的反向代理功能提供负载均衡支持 http { #文件扩展名与文件类型映射表 include mime.types; #默认文件类型 default_type application/octet-stream; #日志格式 log_format main $remote_addr $remote_user [$time_local] $request […]
View DetailsExample Configuration Directives proxy_bind proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_bypass proxy_cache_convert_head proxy_cache_key proxy_cache_lock proxy_cache_lock_age proxy_cache_lock_timeout proxy_cache_max_range_offset proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_purge proxy_cache_revalidate proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_cookie_domain proxy_cookie_path proxy_force_ranges proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_http_version proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_limit_rate proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_next_upstream_timeout proxy_next_upstream_tries proxy_no_cache proxy_pass proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_request_buffering proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_certificate proxy_ssl_certificate_key proxy_ssl_ciphers proxy_ssl_crl proxy_ssl_name proxy_ssl_password_file proxy_ssl_server_name proxy_ssl_session_reuse proxy_ssl_protocols proxy_ssl_trusted_certificate proxy_ssl_verify proxy_ssl_verify_depth proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path Embedded Variables The ngx_http_proxy_module module allows passing requests to another server. Example Configuration
|
1 2 3 4 5 |
location / { proxy_pass http://localhost:8000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } |
Directives Syntax: proxy_bind […]
View Details