nginx基于端口的虚拟主机:
2016-03-23 10:29
513 查看
[root@nginx extra]# cat /etc/nginx/nginx.conf
user nginx nginx;
worker_processes 6;
error_log /app/log/nginx_error.log crit;
pid /app/log/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
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 /app/log/http.access.log main;
keepalive_timeout 65;
include /extra/*.conf;
}
[root@nginx extra]#
[root@nginx extra]# cat www.conf
server {
listen 80;
server_name www.etangbo.com;
access_log /app/log/www/host.access.log main;
location / {
root /data/www;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[root@nginx extra]# cat bbs.conf
###
server {
listen 8081;
server_name bbs.etangbo.com;
access_log /app/log/bbs/host.access.log main;
location / {
root /data/bbs;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[root@nginx extra]# cat blog.conf
###
server {
listen 8080;
server_name blog.etangbo.com;
access_log /app/log/blog/host.access.log main;
location / {
root /data/blog;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[root@nginx extra]#
################################################
还可以做基于IP的虚拟主机,这儿就不演示了,很简单
user nginx nginx;
worker_processes 6;
error_log /app/log/nginx_error.log crit;
pid /app/log/nginx.pid;
events {
use epoll;
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
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 /app/log/http.access.log main;
keepalive_timeout 65;
include /extra/*.conf;
}
[root@nginx extra]#
[root@nginx extra]# cat www.conf
server {
listen 80;
server_name www.etangbo.com;
access_log /app/log/www/host.access.log main;
location / {
root /data/www;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[root@nginx extra]# cat bbs.conf
###
server {
listen 8081;
server_name bbs.etangbo.com;
access_log /app/log/bbs/host.access.log main;
location / {
root /data/bbs;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[root@nginx extra]# cat blog.conf
###
server {
listen 8080;
server_name blog.etangbo.com;
access_log /app/log/blog/host.access.log main;
location / {
root /data/blog;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[root@nginx extra]#
################################################
还可以做基于IP的虚拟主机,这儿就不演示了,很简单
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Nginx+Naxsi部署专业级Web应用防火墙
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 用zabbix监控nginx_status状态
- 互联网业内的迷雾 谨慎选择虚拟主机
- 选定虚拟主机 性能凸显优势
- 开通虚拟主机时提示Server.CreateObject失败的解决办法
- 用vbs实现虚拟主机和域名查循的脚本
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- 把Lua编译进nginx步骤方法
- 星外虚拟主机平台国内五大域名接口设置方法
- web 应用中常用的各种 cache详解