Home >Backend Development >PHP Tutorial >Configure nginx to support php
This article mainly introduces the configuration of nginx to support php, which has certain reference value. Now I share it with everyone. Friends in need can refer to it
server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.php index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
The code must be written in the server
Save and restart nginx
Restart php service php-fpm restart
Related recommendations:
Configure nginx php mysql to start automatically
The above is the detailed content of Configure nginx to support php. For more information, please follow other related articles on the PHP Chinese website!