首頁  >  文章  >  後端開發  >  Nginx 設定筆記

Nginx 設定筆記

WBOY
WBOY原創
2016-07-28 08:27:371126瀏覽

引子

本篇记录学习 nginx 的点滴

主要配置

与 PHP 整合

<code>vim nginx.conf

location / {
    root   /var/www/html;
    index  index.html index.php;
    <span># ThinkPHP hide index.php</span>
    try_files <span>$uri</span><span>$uri</span>/ /index.php?s=<span>$uri</span>&<span>$args</span>;
}

location ~ \.php {
    root /var/www/html;
    fastcgi_pass <span>127.0</span>.<span>0.1</span>:<span>9000</span>;
    fastcgi_index index.php;
    include fastcgi_params;
    <span>set</span><span>$path_info</span><span>""</span>;
    <span>set</span><span>$real_script_name</span><span>$fastcgi_script_name</span>;
    <span>if</span> (<span>$fastcgi_script_name</span> ~ <span>"^(.+?\.php)(/.+)$"</span>) {
    <span>set</span><span>$real_script_name</span><span>$1</span>;
    <span>set</span><span>$path_info</span><span>$2</span>;
    }
    fastcgi_param SCRIPT_FILENAME <span>$document_root</span><span>$real_script_name</span>;
    fastcgi_param SCRIPT_NAME <span>$real_script_name</span>;
    fastcgi_param PATH_INFO <span>$path_info</span>;
}</code>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了 Nginx 配置笔记,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn