惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
H
Hacker News: Front Page
Apple Machine Learning Research
Apple Machine Learning Research
TaoSecurity Blog
TaoSecurity Blog
Help Net Security
Help Net Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)
Security Latest
Security Latest
Cloudbric
Cloudbric
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Know Your Adversary
Know Your Adversary
A
Arctic Wolf
L
LangChain Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The GitHub Blog
The GitHub Blog
P
Proofpoint News Feed
W
WeLiveSecurity
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
M
MIT News - Artificial intelligence
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
小众软件
小众软件
NISL@THU
NISL@THU
云风的 BLOG
云风的 BLOG
P
Privacy & Cybersecurity Law Blog
S
Security @ Cisco Blogs
博客园 - 【当耐特】
I
InfoQ
Vercel News
Vercel News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Proofpoint News Feed
O
OpenAI News
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
量子位
宝玉的分享
宝玉的分享

博客园 - 一九零零

python 中文乱码解决 用户中心 - 博客园 Windows Nginx 下启动关闭的管理批处理脚本 HttpRuntime.Cache[""] 泛型强制转换时 值类型的错误 解决不能加载 MagicNet.dll 组件 固定长度和变长 字符串 对 默认值的处理 C#写COM组件提供ASP使用(转) - 一九零零 - 博客园 如何使用FindControl查找内容页上的某个控件? - 一九零零 - 博客园 jQuery.Validate 使用笔记 整理和收集一些 AspNetPager 分页样式,比较美观 排序 SELECT INTO 生成的表 默认的一个排序序号字段是,自增长标识列 Win 2003 系统下,发布 Asp.Net Ajax 带来的环境问题 数据库备份打包工具 Asp.NET 网站程序,在 IIS6.0 部署时出现的环境问题集? 发布一款实体代码生成器 V3.0 格式相对美观 网页效果方面的建议 有关 VS 2008 Toolbox 载入控件重复的解决办法! @@IDENTITY,SCOPE_IDENTITY和IDENT_CURRENT的辨析 IE中打开UTF-8编码title为中文的网页会显示空白页的问题
window nginx 多站点(虚拟主机)配置
一九零零 · 2012-12-03 · via 博客园 - 一九零零

nginx 目录结构

nginx-0.8.54
│  nginx.exe //主程序
│ 
├─conf
│  │  fastcgi_params
│  │  koi-utf
│  │  koi-win
│  │  mime.types
│  │  nginx.conf  //核心配置文件
│  │  win-utf
│  │ 
│  └─vhost //虚拟主机目录
│          www.uctest.conf
│          news.uctest.conf
│         
├─contrib
│  │  geo2nginx.pl
│  │  README
│  │ 
│  └─unicode2nginx
│          koi-utf
│          unicode-to-nginx.pl
│          win-utf
│         
├─docs
│      CHANGES
│      CHANGES.ru
│      LICENSE
│      OpenSSL.LICENSE
│      PCRE.LICENCE
│      README
│      zlib.LICENSE
│     
├─html
│      50x.html
│      index.html
│     
├─logs
│      access.log
│      error.log
│      nginx.pid
│     
└─temp
    ├─client_body_temp
    ├─fastcgi_temp
    └─proxy_temp

进入conf文件夹,将内部的server配置段提取单独放在一个文件里,存到了conf/vhost下,以方便配置多个虚拟主机。
并在nginx.conf里http配置段内添加了一行 include vhost/*.conf;用来读取vhost下的虚拟主机配置。

  修改后的nginx.conf 配置文件

#user  nobody;
worker_processes  1;

#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;
}


http {
    include        mime.types;
    default_type    application/octet-stream;
    sendfile        on;

    keepalive_timeout    65;

    #gzip  on; 

    include vhost/*.conf;        #加载vhost目录下的虚拟主机配置文件
}

 修改vhost 下的虚拟主机配置文件以www.uctest.com为例,在server_name 后添加网站域名,可添加多个,多个之间“空格”分开;

root 节用来配置网站文件路径,路径格式:d:/www/www.uctest.com;

server {
        listen       80;
        server_name  download-bj.tv0714.com;    #可配置多个主机头

        location / {
            root   d:/www/www.uctest.com;        #网站文件路径
            index  index.htm index.html;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

 管理脚本:请打开http://www.cnblogs.com/leleroyn/archive/2010/07/08/1773388.html这里参观。下面附上一份: 

Rem 提供Windows下nginx的启动,重启,关闭功能

cls 
@ECHO OFF 
SET NGINX_PATH=E: 
SET NGINX_DIR=E:\nginx-0.8.40\
color 0a 
TITLE Nginx 管理程序 Power By Ants (http://leleroyn.cnblogs.com)
GOTO MENU 
:MENU 
CLS 
ECHO. 
ECHO. * * * *  Nginx 管理程序 Power By Ants (http://leleroyn.cnblogs.com) * * *  
ECHO. * * 
ECHO. * 1 启动Nginx * 
ECHO. * * 
ECHO. * 2 关闭Nginx * 
ECHO. * * 
ECHO. * 3 重启Nginx * 
ECHO. * * 
ECHO. * 4 退 出 * 
ECHO. * * 
ECHO. * * * * * * * * * * * * * * * * * * * * * * * * 
ECHO. 
ECHO.请输入选择项目的序号: 
set /p ID= 
IF "%id%"=="1" GOTO cmd1 
IF "%id%"=="2" GOTO cmd2 
IF "%id%"=="3" GOTO cmd3 
IF "%id%"=="4" EXIT 
PAUSE 
:cmd1 
ECHO. 
ECHO.启动Nginx...... 
IF NOT EXIST %NGINX_DIR%nginx.exe ECHO %NGINX_DIR%nginx.exe不存在 
%NGINX_PATH% 
cd %NGINX_DIR% 
IF EXIST %NGINX_DIR%nginx.exe start %NGINX_DIR%nginx.exe 
ECHO.OK 
PAUSE 
GOTO MENU 
:cmd2 
ECHO. 
ECHO.关闭Nginx...... 
taskkill /F /IM nginx.exe > nul 
ECHO.OK 
PAUSE 
GOTO MENU 
:cmd3 
ECHO. 
ECHO.关闭Nginx...... 
taskkill /F /IM nginx.exe > nul 
ECHO.OK 
GOTO cmd1 
GOTO MENU 

别名超长的解决办法,在  http 段加入:

server_names_hash_bucket_size 64;    #域名长度 

如果64个不够,再按32的倍数继续加大;

 这样,总体就非常方便了!

参考地址:

http://www.hong100.cn/B.php?TID=8979

http://www.cnblogs.com/leleroyn/archive/2010/07/08/1773388.html

 http://www.cnblogs.com/jiangyao/archive/2010/06/24/1764627.html