php 的 nginx 配置

default.conf

# You may add here your
# server {
#   ...
# }
# statements for each of your virtual hosts to this file

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html/CI;
    index index.php index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        #try_files $uri $uri/ /index.php?$query_string;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
        root /usr/share/nginx/html/CI;
        index  index.html index.htm index.php;
        rewrite ^/$ /index.php last;
        rewrite ^/(?!index\.php|robots\.txt|images|js|styles)(.*)$ /index.php/$1 last;
         #index  index.php;
#           try_files $uri $uri/ /index.php?$uri&$args;
    }

    # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
    #location /RequestDenied {
    #   proxy_pass http://127.0.0.1:8080;    
    #}

    error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html/CI;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ ^.+\.php {
        #try_files $uri /index.php  =404;
    #   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #
    #   # With php5-cgi alone:
        #fastcgi_pass 127.0.0.1:9000;
    #   # With php5-fpm:
            root /usr/share/nginx/html/CI;
#           include fastcgi_params;
                fastcgi_index  index.php;
                fastcgi_split_path_info ^(.+\.php)(.*)$;
                fastcgi_param   PATH_INFO $fastcgi_path_info;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param    PATH_TRANSLATED    $document_root$fastcgi_path_info;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
            include        fastcgi_params;
    }

#   if (!-e $request_filename) {
#            rewrite ^/(.*)$ /index.php/$1 last;
 #           break;
  #      } 

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
#   location ~ /\.ht {
#       deny all;
#   }
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#   listen 8000;
#   listen somename:8080;
#   server_name somename alias another.alias;
#   root html;
#   index index.html index.htm;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}


# HTTPS server
#
#server {
#   listen 443;
#   server_name localhost;
#
#   root html;
#   index index.html index.htm;
#
#   ssl on;
#   ssl_certificate cert.pem;
#   ssl_certificate_key cert.key;
#
#   ssl_session_timeout 5m;
#
#   ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
#   ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
#   ssl_prefer_server_ciphers on;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
  • 序言:七十年代末胞谈,一起剝皮案震驚了整個濱河市殖熟,隨后出現的幾起案子亏较,更是在濱河造成了極大的恐慌肄梨,老刑警劉巖底桂,帶你破解...
    沈念sama閱讀 216,651評論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件盛险,死亡現場離奇詭異囱晴,居然都是意外死亡屯掖,警方通過查閱死者的電腦和手機性湿,發(fā)現死者居然都...
    沈念sama閱讀 92,468評論 3 392
  • 文/潘曉璐 我一進店門来累,熙熙樓的掌柜王于貴愁眉苦臉地迎上來砚作,“玉大人,你說我怎么就攤上這事嘹锁『迹” “怎么了?”我有些...
    開封第一講書人閱讀 162,931評論 0 353
  • 文/不壞的土叔 我叫張陵领猾,是天一觀的道長米同。 經常有香客問我,道長摔竿,這世上最難降的妖魔是什么面粮? 我笑而不...
    開封第一講書人閱讀 58,218評論 1 292
  • 正文 為了忘掉前任,我火速辦了婚禮继低,結果婚禮上熬苍,老公的妹妹穿的比我還像新娘。我一直安慰自己袁翁,他們只是感情好柴底,可當我...
    茶點故事閱讀 67,234評論 6 388
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著粱胜,像睡著了一般柄驻。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上焙压,一...
    開封第一講書人閱讀 51,198評論 1 299
  • 那天鸿脓,我揣著相機與錄音,去河邊找鬼涯曲。 笑死野哭,一個胖子當著我的面吹牛,可吹牛的內容都是我干的幻件。 我是一名探鬼主播虐拓,決...
    沈念sama閱讀 40,084評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼傲武!你這毒婦竟也來了蓉驹?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 38,926評論 0 274
  • 序言:老撾萬榮一對情侶失蹤揪利,失蹤者是張志新(化名)和其女友劉穎态兴,沒想到半個月后,有當地人在樹林里發(fā)現了一具尸體疟位,經...
    沈念sama閱讀 45,341評論 1 311
  • 正文 獨居荒郊野嶺守林人離奇死亡瞻润,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,563評論 2 333
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片绍撞。...
    茶點故事閱讀 39,731評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡正勒,死狀恐怖,靈堂內的尸體忽然破棺而出傻铣,到底是詐尸還是另有隱情章贞,我是刑警寧澤,帶...
    沈念sama閱讀 35,430評論 5 343
  • 正文 年R本政府宣布非洲,位于F島的核電站鸭限,受9級特大地震影響,放射性物質發(fā)生泄漏两踏。R本人自食惡果不足惜败京,卻給世界環(huán)境...
    茶點故事閱讀 41,036評論 3 326
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望梦染。 院中可真熱鬧赡麦,春花似錦、人聲如沸帕识。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,676評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽渡冻。三九已至戚扳,卻和暖如春忧便,著一層夾襖步出監(jiān)牢的瞬間族吻,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,829評論 1 269
  • 我被黑心中介騙來泰國打工珠增, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留超歌,地道東北人。 一個月前我還...
    沈念sama閱讀 47,743評論 2 368
  • 正文 我出身青樓蒂教,卻偏偏與公主長得像巍举,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子凝垛,可洞房花燭夜當晚...
    茶點故事閱讀 44,629評論 2 354

推薦閱讀更多精彩內容