手机版
你好,游客 登录 注册
背景:
阅读新闻

Nginx:强劲的Web引擎

[日期:2013-04-27] 来源:Linux社区  作者:tywangpanpan [字体: ]

三:Nginx的一些基础应用

【基于ip地址的虚拟主机】(vim /etc/nginx/nginx.conf)

添加两块网卡:eth0 192.168.145.100

eth0:0 192.168.145.101

server {

listen 192.168.145.100:80;

server_name localhost;

 

location / {

root html;

index index.html index.htm;

}

error_log /var/log/nginx/error.log;

access_log /var/log/nginx/access.log;

 

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

server {

listen 192.168.145.101:80;

server_name localhost;

 

location / {

root /tec;

index index.html index.htm;

}

error_log /var/log/nginx/tec_error.log;

access_log /var/log/nginx/tec_access.log;

 

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

【基于主机头的虚拟主机】(vim /etc/nginx/nginx.conf)

server {

listen 192.168.145.100:80;

server_name www.wpp.com;

 

location / {

root html;

index index.html index.htm;

}

error_log /var/log/nginx/error.log;

access_log /var/log/nginx/access.log;

 

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

server {

listen 192.168.145.100:80;

server_name tec.wpp.com;

 

location / {

root /tec;(这个目录要自己建立,目录下放置主页html文件

index index.html index.htm;

}

error_log /var/log/nginx/tec_error.log;

access_log /var/log/nginx/tec_access.log;

 

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

}

加密访问】

Step1:建立证书颁发机构CA

vim /etc/pki/tls/openssl.cnf

linux
相关资讯       Nginx 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款