Home > Article > Backend Development > PHP website modifies nginx configuration of default access files
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; } }
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!