PHP 网站修改默认访问文件的nginx配置


搭建好lnmp后,有时候并不需要直接访问index.php,配置其他的默认访问文件比如index.html这时候需要配置一下nginx才能访问到你想要设置的文件

直接上代码,如下是我的配置的一份简单的nginx到php-fpm的站点,该站点默认访问目录/ecmoban/www/index.html

server {
listen 80;
location / {
root /ecmoban/www;
index index.html index.php index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ .php$ {
root /ecmoban/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.html;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

以上所述是小编给大家介绍的PHP 网站修改默认访问文件的nginx配置,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对积木网网站的支持!

使用一个for循环将N*N的二维数组的所有值置1实现方法
废话不多说,直接上代码php//使用一个for循环将N*N的二维数组的所有值置1$n=3;$a=[];for($i=0;$i$n*$n;$i++){$a[$i/$n][$i%$n]=1;}print_r($a);以上这篇使用一个for循环将N*

PHP用户注册邮件激活账户的实现代码
我们在注册一个网站的账户时,通常都会收到一封含点击链接激活的邮件,而它是怎么激活我们的账户的呢,今天向大家介绍一种方法。预备条件我们

php获取数据库中数据的实现方法
废话不多说,直接上代码phpheader("Content-type:text/html;charset=utf-8");//字符编码设置$servername="localhost";$username="root";$password="root";$dbname="web";//创建连接$con=mysqli