nginx 虚拟主机配置
2016-02-09 21:08
756 查看
首先配置两个IP
ifconfig eth0:1 192.168.16.110 broadcast 192.168.16.255 netmask 255.255.225.0
ifconfig eth0:2 192.168.16.108 broadcast 192.168.16.255 netmask 255.255.225.0
以上配置是为eth0 网口 配置了两个IP
然后在nginx_home 下面的/conf 目录下添加 xunizhuli.conf 文件 文件内容如下:
在nginx home目录下的html文件夹下建立server1 和 server2 , 然后分别新建 index.html
执行./nginx -c /root/local/nginx/conf/xunizhuji.conf 即可
ifconfig eth0:1 192.168.16.110 broadcast 192.168.16.255 netmask 255.255.225.0
ifconfig eth0:2 192.168.16.108 broadcast 192.168.16.255 netmask 255.255.225.0
以上配置是为eth0 网口 配置了两个IP
然后在nginx_home 下面的/conf 目录下添加 xunizhuli.conf 文件 文件内容如下:
<span style="font-size:18px;">user nobody; worker_processes 4; events{ worker_connections 1024; } http{ server{ listen 192.168.16.108:80; server_name 192.168.16.108; access_log logs/server1.access.log combined; location / { index index.html index.htm; root html/server1; } } server{ listen 192.168.16.110:80; server_name 192.168.16.110; access_log logs/server2.access.log combined; location / { index index.html index.htm; root html/server2; } } }</span>
在nginx home目录下的html文件夹下建立server1 和 server2 , 然后分别新建 index.html
执行./nginx -c /root/local/nginx/conf/xunizhuji.conf 即可
相关文章推荐
- centos6.5安装nginx+php+mysql
- NGINX301 REWRITE官方博客文档
- 【Nginx笔记】nginx配置文件具体解释
- Linux安装配置php7+nginx
- mac下 home-brew安装及php,nginx环境安装及配置
- Nginx简介
- Linux下的Nginx安装
- 阿里云linux CentOS6.5(nginx+PHP-fpm)及RDS初级使用指南和简单安全设置
- install Nginx iptables
- Nginx配置文件nginx.conf中文详解
- nginx日记切割脚本,mysql定期备份脚本
- centos 7.0 安装nginx 1.9.10
- nginx报错 client intended to send too large body: 1331696 bytes
- 改变nginx logrotate方式采用sh文件自动切割日志文件
- nginx+keepalived(带nginx监控脚本)
- 使用nginx搭建流媒体直播平台(该方式不适用与多人聊天)
- rails nginx + passenger
- Nginx 配置文件详解
- Openresty 数据共享API.Data Sharing within an Nginx Worker
- 很详细的Nginx配置说明