标签:style 配置 name nec out ons ide dex html
在 nginx.conf 中,一个 Server块 就是一个虚拟主机,一个虚拟主机就是一个独立的 Web站点
(1) 基于域名的虚拟主机:通过不同的域名区分不同的虚拟主机,最常用
(2) 基于端口的虚拟主机:通过不同的端口区分不同的虚拟主机
(3) 基于 IP 的虚拟主机:通过不同的 IP 区分不同的虚拟主机
worker_processes 1; user nobody nobody; pid /usr/local/nginx/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name www.xxxxx.com; location / { root html/www; index index.html index.htm; } } }
worker_processes 1; user nobody nobody; pid /usr/local/nginx/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name www.xxxxx.com; location / { root html/www; index index.html index.htm; } } server { listen 80; server_name bbs.xxxxx.com; location / { root html/bbs; index index.html index.htm; } } server { listen 80; server_name blog.xxxxx.com; location / { root html/blog; index index.html index.htm; } } }
worker_processes 1; user nobody nobody; pid /usr/local/nginx/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name www.xxxxx.com; location / { root html/www; index index.html index.htm; } } server { listen 81; server_name bbs.xxxxx.com; location / { root html/bbs; index index.html index.htm; } } server { listen 82; server_name blog.xxxxx.com; location / { root html/blog; index index.html index.htm; } } }
## 前提:要有多个网卡 worker_processes 1; user nobody nobody; pid /usr/local/nginx/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 192.168.1.1:80; server_name www.xxxxx.com; location / { root html/www; index index.html index.htm; } } server { listen 192.168.1.2:80; server_name bbs.xxxxx.com; location / { root html/bbs; index index.html index.htm; } } server { listen 192.168.1.3:80; server_name blog.xxxxx.com; location / { root html/blog; index index.html index.htm; } } }
标签:style 配置 name nec out ons ide dex html
原文地址:http://www.cnblogs.com/pzk7788/p/6714980.html