nginx pathinfo configuration, suitable for higher versions of nginx nginx pathinfo support nginx rewrite pathinfo nginx pathinfo support

WBOY
Release: 2016-07-29 08:48:51
Original
723 people have browsed it

Environment centos6, nginx1.6.2, code location: [nginxpath]/conf.d/default.conf

<code>server {
        listen       <span>80</span>;
        server_name  _;
        root        /<span>var</span>/www/html/;

    <span>#access_log  logs/host.access.log  main;</span>    location / {

        index  index.html index.php index.htm;
        <span>if</span> (-e <span>$request_filename</span>) {
               <span>break</span>;
        }
        <span>if</span> (!-e <span>$request_filename</span>) {
               <span>#rewrite 规则填写位置</span>
               rewrite ^/(.*)$ /index.php/$<span>1</span> last;
               <span>break</span>;
        }
    }

    error_page  <span>404</span>              /<span>404.</span>html;
    location = /<span>404.</span>html {
        root   /<span>var</span>/www/error;
    }

    error_page   <span>500</span><span>502</span><span>503</span><span>504</span>  /<span>50</span>x.html;
    location = /<span>50</span>x.html {
        root   /<span>var</span>/www/error;
    }

    location ~ ^.+.php($|/) {

        fastcgi_pass   <span>127.0</span><span>.0</span><span>.1</span>:<span>9000</span>;
        fastcgi_index  index.php;
        fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
        fastcgi_param SCRIPT_FILENAME  <span>$document_root</span><span>$fastcgi_script_name</span>;
        fastcgi_param SCRIPT_NAME <span>$fastcgi_script_name</span>;
        fastcgi_param PATH_INFO <span>$fastcgi_path_info</span>;
        fastcgi_param PATH_TRANSLATED <span>$document_root</span><span>$fastcgi_path_info</span>;
        <span>include</span> fastcgi_params;

    }

}
</code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the nginx pathinfo configuration, which is suitable for higher versions of nginx, including pathinfo and nginx content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!