|
|
本帖最后由 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文件呢? |
|