Build Lnmp in the normal access, but PHP files can only download unable to open the problem handling method
First of all, we first understand the following installation of Nginx directory:
|--nginx
|-conf.d
|-default.conf
|-fastcgi_params.default
|-nginx.conf
|-uwsgi_params.default
|-default.d
|-koi-utf
|-nginx.conf.default
|-win-utf
|-fastcgi.conf
|-koi-win
|-scgi_params
|-fastcgi.conf.default
|-mime.types
|-scgi_params.default
|-fastcgi_params
|-mime.types.default
|-uwsgi_params
Many posts say this is a problem to modify the configuration inside the nignx/conf.d/default.conf, and modify the following:
server {
Listen ; root /usr/share/nginx/html; server_name localhost;
#charset Koi8-r; #access_log /var/log/nginx/log/host.access.log main;
Location/{ index index.html index.htm; }
#error_page 404 /404.html;
# REDIRECT Server error pages to the static page/50x.html # error_page 502 503 504/50x.html;
location =/50x.html { root /usr/share/nginx/html; }
# Proxy The PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # Proxy_pass H ttp://127.0.0.1; #}
# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { Fastcgi_pass
127.0.0.1:9000; Fastcgi_index index.php; Fastcgi_param script_filename $document _root$fastcgi_script_name; Include fastcgi_params; } # Deny access to. htaccess files, if Apache ' s document Root # concurs with Nginx ' s one # #location ~/\.ht { # deny all ; #}
}
But I still can't, and I'll change it and add the code below nginx/nginx.conf.
Location ~ \.php$ { fastcgi_pass 127.0.0.1:9000;
Root /usr/share/nginx/html;//your php file path
}
The result will be able to run. In summary, the scope of the Conf file is different.
Lnmp encountered PHP can only download unable to open processing