Home > Backend Development > PHP Tutorial > lnmp 二级目录index.htm无法访问

lnmp 二级目录index.htm无法访问

WBOY
Release: 2016-06-06 20:49:59
Original
998 people have browsed it

二级目录下的静态文件index.htm无法访问

nginx的一个conf片段:

<code>location / {
       root   /usr/share/nginx/html/www.abc.com;
        index  index.php index.htm;
    if (!-f $request_filename){
        set $rule_1 1$rule_1;
    }
    if (!-d $request_filename){
        set $rule_1 2$rule_1;
    }
    if ($rule_1 = "21"){
        rewrite /. /index.php last;
    }

    }

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

    location ~ \.php$ {
        root   /usr/share/nginx/html/www.abc.com;
        fastcgi_pass   unix:/var/run/php-fpm.socket;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html/www.abc.com$fastcgi_script_name;
        include        fastcgi_params;
    }
</code>
Copy after login
Copy after login

回复内容:

二级目录下的静态文件index.htm无法访问

nginx的一个conf片段:

<code>location / {
       root   /usr/share/nginx/html/www.abc.com;
        index  index.php index.htm;
    if (!-f $request_filename){
        set $rule_1 1$rule_1;
    }
    if (!-d $request_filename){
        set $rule_1 2$rule_1;
    }
    if ($rule_1 = "21"){
        rewrite /. /index.php last;
    }

    }

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

    location ~ \.php$ {
        root   /usr/share/nginx/html/www.abc.com;
        fastcgi_pass   unix:/var/run/php-fpm.socket;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html/www.abc.com$fastcgi_script_name;
        include        fastcgi_params;
    }
</code>
Copy after login
Copy after login
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