nginx虛擬主機配置

server {
    listen       80;
    server_name  blog.jlhou.cn;
    root         /web/blog.jlhou.cn/web;

    location / {
        index  index.html index.php index.htm;
        # 隱藏index.php文件
        if (!-e $request_filename){
           rewrite ^/(.*)$ /index.php/$1 last;
        }
    }

    location ~ \.php {
        fastcgi_pass   127.0.0.1:9000;
        # 入口文件
        fastcgi_index  index.php;
        # 開啓支持pathinfo路由模式
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    error_page 404 403 /404.html;
            location = /40x.html {
        }

    error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
}

記錄一下

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章