Lnmp encountered PHP can only download unable to open processing

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.