免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2371 | 回复: 3
打印 上一主题 下一主题

[网络配置] centos 6.3 nginx-0.8x 虚拟主机配置问题: [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-01-05 14:52 |只看该作者 |倒序浏览
nginx.conf 配置文件如下:
  1. user  www www;

  2. worker_processes 8;

  3. error_log  /data/nginx_logs/nginx_error.log  crit;

  4. pid        /usr/local/webserver/nginx/nginx.pid;

  5. #Specifies the value for maximum file descriptors that can be opened by this process.
  6. worker_rlimit_nofile 65535;

  7. events
  8. {
  9.   use epoll;
  10.   worker_connections 65535;
  11. }

  12. http
  13. {
  14.   include       mime.types;
  15.   default_type  application/octet-stream;

  16.   #charset  gb2312;
  17.       
  18.   server_names_hash_bucket_size 128;
  19.   client_header_buffer_size 32k;
  20.   large_client_header_buffers 4 32k;
  21.   client_max_body_size 8m;
  22.       
  23.   sendfile on;
  24.   tcp_nopush     on;

  25.   keepalive_timeout 60;

  26.   tcp_nodelay on;

  27.   fastcgi_connect_timeout 300;
  28.   fastcgi_send_timeout 300;
  29.   fastcgi_read_timeout 300;
  30.   fastcgi_buffer_size 64k;
  31.   fastcgi_buffers 4 64k;
  32.   fastcgi_busy_buffers_size 128k;
  33.   fastcgi_temp_file_write_size 128k;

  34.   gzip on;
  35.   gzip_min_length  1k;
  36.   gzip_buffers     4 16k;
  37.   gzip_http_version 1.0;
  38.   gzip_comp_level 2;
  39.   gzip_types       text/plain application/x-javascript text/css application/xml;
  40.   gzip_vary on;

  41.   #limit_zone  crawler  $binary_remote_addr  10m;

  42.   server
  43.   {
  44.     listen       80;
  45.     server_name  www.jly.com;
  46.     index index.html index.htm index.php;
  47.     root  /data/server/blog;

  48.     #limit_conn   crawler  20;   
  49.                              
  50.     location ~ .*\.(php|php5)?$
  51.     {      
  52.       #fastcgi_pass  unix:/tmp/php-cgi.sock;
  53.       fastcgi_pass  127.0.0.1:9000;
  54.       fastcgi_index index.php;
  55.       include fcgi.conf;
  56.     }
  57.    
  58.     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  59.     {
  60.       expires      30d;
  61.     }

  62.     location ~ .*\.(js|css)?$
  63.     {
  64.       expires      1h;
  65.     }   

  66.     log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  67.               '$status $body_bytes_sent "$http_referer" '
  68.               '"$http_user_agent" $http_x_forwarded_for';
  69.     access_log  /data/nginx_logs/access.log  access;
  70.       }

  71.   server
  72.   {
  73.     listen       80;
  74.     server_name  www.s135.com;
  75.     index index.html index.htm index.php;
  76.     root  /data/server/www;

  77.     location ~ .*\.(php|php5)?$
  78.     {      
  79.       #fastcgi_pass  unix:/tmp/php-cgi.sock;
  80.       fastcgi_pass  127.0.0.1:9000;
  81.       fastcgi_index index.php;
  82.       include fcgi.conf;
  83.     }

  84.     log_format  wwwlogs  '$remote_addr - $remote_user [$time_local] "$request" '
  85.                '$status $body_bytes_sent "$http_referer" '
  86.                '"$http_user_agent" $http_x_forwarded_for';
  87.     access_log  /data/nginx_logs/wwwlogs.log  wwwlogs;
  88.   }

  89. }
复制代码
当在本地访问localhost时指向的为第一个server的root路径,但当我访问www.jly.com时,浏览器就直接跳转到互联网上,不会访问本地的root目录。请指教?


论坛徽章:
29
技术图书徽章
日期:2013-09-02 19:59:502015元宵节徽章
日期:2015-03-06 15:51:332015小元宵徽章
日期:2015-03-06 15:57:20操作系统版块每日发帖之星
日期:2015-08-16 06:20:002015七夕节徽章
日期:2015-08-21 11:06:17操作系统版块每日发帖之星
日期:2015-09-21 06:20:002015亚冠之水原三星
日期:2015-10-30 00:06:07数据库技术版块每日发帖之星
日期:2015-12-24 06:20:0015-16赛季CBA联赛之上海
日期:2016-01-07 10:32:07操作系统版块每日发帖之星
日期:2016-01-08 06:20:00操作系统版块每日发帖之星
日期:2016-05-18 06:20:00IT运维版块每日发帖之星
日期:2016-07-23 06:20:00
2 [报告]
发表于 2013-01-05 14:54 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
3 [报告]
发表于 2013-01-05 14:56 |只看该作者
检查下dns设置,在本机测试的话,将域名/ip写到hosts文件里面测试

论坛徽章:
0
4 [报告]
发表于 2013-01-05 15:09 |只看该作者
回复 3# chenyx


    谢谢,多贵帮助,好了。{:2_168:}
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP