您的位置:首页 > 运维架构 > Nginx

nginx 最简单的虚拟主机配置

2014-02-18 10:52 399 查看
server{

       //监听端口

        listen 80;

        //设置字符集

        charset utf-8;

        //网站根目录

        root /var/www/kuku;

        //默认读取文件

        index index.html index.php index.htm;

        //访问域名

        server_name kuku test.t.com;

       

        location / {
                index index.php;

                //重定向规则

                if (!-f $request_filename){

                        rewrite ^/(.*)$ /index.php?_r=$1 last;

                        break;

                }

        }

       //配置这项 意思是将后缀名为.php的文件都交给fastCGI处理 如果不配置这里 那么.php文件将无法正常解析

        location ~ \.php$ {

                fastcgi_split_path_info ^(.+\.php)(/.+)$;

                fastcgi_pass 127.0.0.1:9000;

        #       fastcgi_pass unix:/var/run/php5-fpm.sock;

                fastcgi_index index.php;

                include fastcgi_params;

        }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: