nginx同一iP多域名配置方法

文章转自:http://blog.itblood.com/nginx-same-ip-multi-domain-configuration.html

下面的是我本机的配置:

server {
        listen 80;
        server_name localhost; #绑定域名
        index index.htm index.html index.php; #默认文件
        root /data/webroot; #网站根目录
        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi_params;
        }
        access_log /data/logs/access.log;
        error_log /data/logs/error.log;
}
server {
        listen 80;
        server_name test.localhost; #绑定域名
        index index.htm index.html index.php; #默认文件
        root /data/webroot/testRoot; #网站根目录
                location ~ \.php$ {
                        fastcgi_pass 127.0.0.1:9000;
                        fastcgi_index index.php;
                        include fastcgi_params;
        }
        access_log /data/logs/test_access.log;
        error_log /data/logs/test_error.log;
}

 

posted @ 2015-04-20 18:35  KoMiles  阅读(1899)  评论(0编辑  收藏  举报