设为首页收藏本站

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

搜索
热搜: 活动 交友 discuz

求助一下nginx的域名绑定 [复制链接]
查看:75 | 回复:7

29

主题

15

回帖

143

积分

注册会员

积分
143
发表于 2012-8-24 15:50:32 | 显示全部楼层 |阅读模式
本帖最后由 jellday 于 2012-8-24 15:51 编辑

想问一下,我要加很多域名,能不能在vhost目录下建一个文件,然后加很多个server 段(就是server{...})?

就是例如 mydomain.conf[ol]
  • server
  •         {
  •                 listen       80;
  •                 server_name abc.mydomain.com;
  •                 index index.html index.htm index.php default.html default.htm default.php;
  •                 root  /home/wwwroot/mydomain.com/abc;
  •                 include none.conf;
  •                 location ~ .*\.(php|php5)?$
  •                         {
  •                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  •                                 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 aaa.mydomain.com;
  •                 index index.html index.htm index.php default.html default.htm default.php;
  •                 root  /home/wwwroot/mydomain.com/aaa;
  •                 include none.conf;
  •                 location ~ .*\.(php|php5)?$
  •                         {
  •                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  •                                 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 bbb.mydomain.com;
  •                 index index.html index.htm index.php default.html default.htm default.php;
  •                 root  /home/wwwroot/mydomain.com/bbb;
  •                 include none.conf;
  •                 location ~ .*\.(php|php5)?$
  •                         {
  •                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  •                                 fastcgi_index index.php;
  •                                 include fcgi.conf;
  •                         }
  •                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  •                         {
  •                                 expires      30d;
  •                         }
  •                 location ~ .*\.(js|css)?$
  •                         {
  •                                 expires      12h;
  •                         }
  •                 access_log off;
  •         }
  • [/ol]复制代码有三个server段,行吗?
    还是说必须每个域名一个conf文件呢?
  • 25

    主题

    126

    回帖

    351

    积分

    中级会员

    积分
    351
    发表于 2012-8-24 15:50:59 | 显示全部楼层
    都额可以

    890

    主题

    8968

    回帖

    2万

    积分

    论坛元老

    积分
    20678
    发表于 2012-8-24 15:53:15 | 显示全部楼层

    471

    主题

    8105

    回帖

    1万

    积分

    论坛元老

    积分
    17707
    发表于 2012-8-24 15:54:39 | 显示全部楼层
    可以呀

    224

    主题

    2144

    回帖

    5032

    积分

    论坛元老

    积分
    5032
    发表于 2012-8-24 15:56:19 | 显示全部楼层
    可以的。

    65

    主题

    1875

    回帖

    4027

    积分

    论坛元老

    积分
    4027
    发表于 2012-8-24 15:56:59 | 显示全部楼层
    多谢各位!

    29

    主题

    15

    回帖

    143

    积分

    注册会员

    积分
    143
     楼主| 发表于 2012-8-24 15:57:56 | 显示全部楼层
    域名不多,分开好。 多的的话自然合并

    308

    主题

    1571

    回帖

    4182

    积分

    论坛元老

    积分
    4182
    发表于 2012-8-24 16:04:52 | 显示全部楼层

    单手摘月 发表于 2012-8-24 15:53



    可以,本来就是全部在nginx.conf里面的,lnmp一键包什么的把他们分开而已

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

    论坛客服/商务合作/投诉举报: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-6-17 16:19 , Processed in 0.023305 second(s), 4 queries , Gzip On, Redis On.

    返回顶部