Nginx在Window上简单的使用
2024-09-01 10:08:58
先上Nginx在Window上的基本常用指令:
IP_hase也可以解决Session共享的问题:不过不推荐这样使用,建议使用 Memcache/redis来处理 session共享的问题
轮询还是权重?(权重就是在后面加上 weight=2 ,这个主要是根据服务器实际的性能来考虑,数据越大命中的机会就越多):
配置截图:
附上完整的配置内容 nginx.conf文件内容如下:
#user nobody;
worker_processes ; #error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
worker_connections ;
} http {
include mime.types;
default_type application/octet-stream; #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; sendfile on;
#tcp_nopush on; #keepalive_timeout ;
keepalive_timeout ; #gzip on; upstream zrfWeb{
server localhost:;
server localhost: weight=;
server localhost:;
} server {
listen ;
server_name 127.0.0.1:; #charset koi8-r; #access_log logs/host.access.log main; location / {
proxy_pass http://zrfWeb;
#deny 127.0.0.1;#拒绝的ip
#allow 172.18.9.100 #允许的ip root html;
index index.html index.htm;
} #error_page /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:;
# 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
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen ;
# listen localhost:;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 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;
# }
#} }
最新文章
- 【视频处理】YUV与RGB格式转换
- MVC利用MvcHtmlString在后台生成HTML
- wpf中手风琴控件Accordion编辑模板后控件不正常。
- laravel 部分路由取消csrf
- ICANN认证企业列表
- 自己写一个与startWith类似的判断方法
- Android入门1:使用VideoView和MediController播放视频
- 分享几个社交类网站常用并且也是最好用的jquery类库
- 如何自动以管理员身份运行.NET程序?
- CString转换为const char*
- JavaScript 基本类型值-Number类型
- Senparc.Weixin SDK 微信公众号 .NET 开发教程 索引
- Programming好文解读系列(—)——代码整洁之道
- 使用perconna xtrabackup备份脚本
- 【一些容易忘记的node的npm命令】【收集】
- (转)python logging模块
- 介绍 Jersey 依赖
- Android开发小问题解决汇总
- SQL语言:DDL/DML/DQL/DCL
- PHP+JQUERY+AJAX上传、裁剪图片