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

nginx默认配置

2016-04-28 10:59 549 查看
server {

    listen 80;

    server_name _;

    access_log /usr/local/nginx/access_nginx.log combined;

    root /var/www/html/default;

    index index.html index.htm index.php;

        location / {

    if (!-e $request_filename) {

        rewrite ^/(.*)$ /index.php/$1;

    }

}

    location /nginx_status {

        stub_status on;

        access_log off;

        allow 127.0.0.1;

        deny all;

        }

        location ~ \.php {

                #fastcgi_pass remote_php_ip:9000;

                fastcgi_pass unix:/dev/shm/php-cgi.sock;

                fastcgi_index index.php;

                include fastcgi_params;

           #nginx配置支持php的pathinfo模式配置方法
       set $real_script_name $fastcgi_script_name;

                        if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {

                        set $real_script_name $1;

                        set $path_info $2;

                        }

                fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;

                fastcgi_param SCRIPT_NAME $real_script_name;

                fastcgi_param PATH_INFO $path_info;

    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {

        expires 30d;

        access_log off;

        }

    location ~ .*\.(js|css)?$ {

        expires 7d;

        access_log off;

        }

    }

    include vhost/*.conf;

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