列举一个典型的Nignx虚拟主机配置,基于域名的配置。

server {
    listen 80; ## listen for ipv4

    server_name www.domain.com doamin.com;
    root        /path/to/www.domain.com/web;
    index       index.php;

    access_log  /path/to/www.domain.com/log/access.log main;
    error_log   /path/to/www.domin.com/log/error.log;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_param SCRIPT_NAME     $1;
		fastcgi_param PATH_INFO       $2;
		fastcgi_param SCRIPT_FILENAME $document_root$1;
    }

    location ~ /\.(ht|svn|git) {
        deny all;
    }
}

最后编辑: 于 3年前

标签

评论列表(0)

    暂无评论