PHP website modifies nginx configuration of default access files

不言
Release: 2023-03-29 14:52:01
Original
1348 people have browsed it

This article mainly introduces the nginx configuration of the PHP website to modify the default access file. Friends who need it can refer to it

After setting up lnmp, sometimes there is no need to directly access index.php to configure other Default access files such as index.html. At this time, you need to configure nginx to access the file you want to set.

Directly enter the code. The following is a simple nginx to php-fpm site that I configured. The site accesses the directory /ecmoban/www/index.html by default

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;
}
}
Copy after login

Related recommendations:

How about the PHP website Coping with large traffic and high concurrency issues

Common attack methods on PHP websites

# #

The above is the detailed content of PHP website modifies nginx configuration of default access files. For more information, please follow other related articles on the PHP Chinese website!

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!