全球主机交流论坛
标题:
求助一下nginx的域名绑定
[打印本页]
作者:
jellday
时间:
2012-8-24 15:50
标题:
求助一下nginx的域名绑定
本帖最后由 jellday 于 2012-8-24 15:51 编辑
想问一下,我要加很多域名,能不能在vhost目录下建一个文件,然后加很多个server 段(就是server{...})?
就是例如 mydomain.conf
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;
}
复制代码
有三个server段,行吗?
还是说必须每个域名一个conf文件呢?
作者:
下面都湿了
时间:
2012-8-24 15:50
都额可以
作者:
单手摘月
时间:
2012-8-24 15:53
提示:
作者被禁止或删除 内容自动屏蔽
作者:
lazyzhu
时间:
2012-8-24 15:54
分开容易管理,脚本如下:
http://loc.xiu.ee/forum.php ... p;page=1#pid1993723
作者:
smyz
时间:
2012-8-24 15:56
可以呀
作者:
完美
时间:
2012-8-24 15:56
可以的。
作者:
jellday
时间:
2012-8-24 15:57
多谢各位!
作者:
solar
时间:
2012-8-24 16:04
域名不多,分开好。 多的的话自然合并
作者:
360安全卫士
时间:
2012-8-24 16:07
单手摘月 发表于 2012-8-24 15:53
可以,本来就是全部在nginx.conf里面的,lnmp一键包什么的把他们分开而已
思密达
欢迎光临 全球主机交流论坛 (https://loc.xiu.ee/)
Powered by Discuz! X3.4