免费注册 查看新帖 |

Chinaunix

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

[FreeBSD] 请教nginx.conf 配置虚拟主机 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-26 15:19 |只看该作者 |倒序浏览
求高人指点:
以下是我的配置,只有第一个res.masedu.cn可以正常访问,但路径修改无效,均为:/usr/local/www,第二个提示403,第三个提示404。请指教:
user  www www;
worker_processes  4;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #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  logs/access.log  main;

    sendfile        on;
    tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    client_header_timeout 3m;
    client_body_timeout  3m;
    client_header_buffer_size 1k;
    large_client_header_buffers 4 4k;
    client_max_body_size 8m;
       
     gzip  on;
     gzip_min_length  1k;
     gzip_buffers     4 8k;
     gzip_http_version 1.1;
     gzip_types       text/plain application/x-javascript text/css text/html application/xml;

        upstream res.masedu.com {
        server 60.171.75.4:80 weight=1;
          }
    server {
        listen       80;
        server_name  60.171.75.4;
        location / {
            root   /usr/local/www;
            index  index.php default.php index.html index.htm default.html default.htm;

              if (-d $request_filename)
              {
                     rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
              }
              include php.conf;               

        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
        upstream www.hdsyj.com {
        server 60.171.75.4:80 weight=2;
          }

        upstream bbs.hdsyj.com {
        server 60.171.75.4:80 weight=3;
          }

    server {
        listen       80;
        server_name  www.hdsyj.com;

        location / {
            root   /usr/local/www;
            index  index.php default.php index.html index.htm default.html default.htm;
                          if (-d $request_filename)
              {
                     rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
              }
              include php.conf;   
        }
                error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        }

        server {
        listen       80;
        server_name  bbs.hdsyj.com;

        location / {
            root   /usr/home/gjf/bbs;
            index  index.php default.php index.html index.htm default.html default.htm;
              if (-d $request_filename)
              {
                     rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
              }
              include php.conf;   
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
        }


}

[ 本帖最后由 panyue 于 2008-6-26 15:33 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2008-06-26 17:34 |只看该作者
结合日志寻找错误的所在。网上都可以找到的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP