设为首页收藏本站

简体中文 繁體中文 English 日本語 Deutsch 한국 사람 بالعربية TÜRKÇE português คนไทย french

搜索
热搜: 活动 交友 discuz

nginx多站点设置..求实例 [复制链接]
查看:90 | 回复:9

9

主题

227

回帖

547

积分

高级会员

积分
547
发表于 2010-3-6 17:09:23 | 显示全部楼层 |阅读模式
要多增加几个,qoocn的方法只能增加两个……不知道增加第三个怎么搞

2

主题

85

回帖

186

积分

注册会员

积分
186
发表于 2010-3-6 17:19:40 | 显示全部楼层
多一个站点多加一个server配置就可以了
    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

1724

主题

4万

回帖

8万

积分

论坛元老

积分
85718
发表于 2010-3-6 17:48:33 | 显示全部楼层




108

主题

286

回帖

960

积分

高级会员

积分
960
发表于 2010-3-6 18:12:32 | 显示全部楼层
复制server段粘贴就是

53

主题

243

回帖

679

积分

高级会员

积分
679
发表于 2010-3-6 18:14:40 | 显示全部楼层
复制了,不行呀,所以才上来问问

9

主题

227

回帖

547

积分

高级会员

积分
547
 楼主| 发表于 2010-3-6 18:16:48 | 显示全部楼层
user  www www;
worker_processes 1;
error_log  /home/www/logs/nginx_error.log  crit;
pid        /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
  use epoll;
  worker_connections 51200;
}
http
{
  include       mime.types;
  default_type  application/octet-stream;
  #charse  gb2312;
  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 8m;
  sendfile on;
  tcp_nopush     on;
  keepalive_timeout 60;
  tcp_nodelay on;
  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;
  gzip on;
  gzip_min_length  1k;
  gzip_buffers     4 16k;
  gzip_http_version 1.0;
  gzip_comp_level 2;
  gzip_types       text/plain application/x-javascript text/css application/xml;
  gzip_vary on;
  #limit_zone  crawler  $binary_remote_addr  10m;
server
{
  listen       80;
  server_name www.yangtai.org;
  index index.html index.htm index.php;
  root  /home/www/www/;
  #limit_conn   crawler  20;
  #location /status {
  #stub_status on;
  #access_log off;
  #}
  location ~ .*\.(php|php5)?$
   {
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    #fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
   }
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
    expires      30d;
   }
  location ~ .*\.(js|css)?$
   {
    expires      12h;
   }
  log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
  access_log  /home/www/logs/access.log  access;
}
server
{
  listen  80;
  server_name  status.lnmp.org;
  location / {
   stub_status on;
   access_log   off;
            
            }
  }
server

{

  listen       80;

  server_name  www.baidu.com;

  index index.html index.htm index.php;

  root  /home/www/;

  location ~ .*\.(php|php5)?$

   {

    fastcgi_pass  unix:/tmp/php-cgi.sock;

    #fastcgi_pass  127.0.0.1:9000;

    fastcgi_index index.php;

    include fcgi.conf;

   }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

   {

    expires      30d;

   }

  location ~ .*\.(js|css)?$

   {

    expires      12h;

   }

  access_log   off;

}
}

server

{

  listen       80;

  server_name  www.baidu2.com;

  index index.html index.htm index.php;

  root  /home/www/;

  location ~ .*\.(php|php5)?$

   {

    fastcgi_pass  unix:/tmp/php-cgi.sock;

    #fastcgi_pass  127.0.0.1:9000;

    fastcgi_index index.php;

    include fcgi.conf;

   }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

   {

    expires      30d;

   }

  location ~ .*\.(js|css)?$

   {

    expires      12h;

   }

  access_log   off;

}
}

9

主题

227

回帖

547

积分

高级会员

积分
547
 楼主| 发表于 2010-3-6 18:19:45 | 显示全部楼层
不知道这样有没有什么错误的

9

主题

227

回帖

547

积分

高级会员

积分
547
 楼主| 发表于 2010-3-6 18:20:19 | 显示全部楼层
nginx -t 测试下是否有报错。

1724

主题

4万

回帖

8万

积分

论坛元老

积分
85718
发表于 2010-3-6 18:49:56 | 显示全部楼层
改成上面的NGINX就没有启动……我安装完 nginx -t 这个命令怎么 说是-bash: nginx: command not found

0

主题

1

回帖

4

积分

新手上路

积分
4
发表于 2010-3-6 18:57:47 | 显示全部楼层


[ol]
  • /usr/local/nginx/sbin/nginx -t[/ol]复制代码或者[ol]
  • ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx
  • 然后
  • nginx -t[/ol]复制代码后面省事

    [ 本帖最后由 Neta 于 2010-3-8 17:57 编辑 ]
  • 本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    ×
    您需要登录后才可以回帖 登录 | 立即注册

    论坛客服/商务合作/投诉举报:2171544 (QQ)
    落伍者创建于2001/03/14,本站内容均为会员发表,并不代表落伍立场!
    拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论!
    落伍官方微信:2030286 邮箱:(djfsys@gmail.com|tech@im286.com)
    © 2001-2014

    浙公网安备 33060302000191号

    浙ICP备11034705号 BBS专项电子公告通信管[2010]226号

      落伍法律顾问: ITlaw-庄毅雄

    Archiver|手机版|Discuz! X

    GMT+8, 2026-11-18 21:53 , Processed in 0.020430 second(s), 10 queries , Gzip On, Redis On.

    返回顶部