LNMP environment problem--nginx do not parse PHP file

Source: Internet
Author: User

PHP, Nginx are all installed, configured for a long time is not right. It's just a good whole.

Nginx.conf began to be

server {listen 8080;
        server_name localhost;
        #charset Koi8-r;
        Access_log Logs/host.access.log Main;
        root/users/yangshuo/work/index.php;
            Location/{root HTML;
        Index index.html index.htm index.php;
        } error_page 404/404.html; 
        Error_page 403/error/403.html;
        # REDIRECT Server error pages to the static page/50x.html # Error_page 502 503 504/50x.html;
        Location =/50x.html {root html; } location ~. *\.
            (Eot|otf|ttf|woff) $ {root html;
        Add_header Access-control-allow-origin *;    # Proxy The PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ {#
        Proxy_pass http://127.0.0.1; # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # 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;
        # Deny access to. htaccess files, if Apache ' s document Root # concurs with Nginx ' s one #
        Location ~/\.ht {deny all;
 }
        }

later changed to

server {listen 8080;
        server_name localhost;
        root/users/yangshuo/work/index.php;
        Index index.php index.html;

        #charset Koi8-r;

        #access_log Logs/host.access.log Main;
        Location/{try_files $uri $uri//index.php $args;

        } #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 html;    # Proxy The PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ {#
        Proxy_pass http://127.0.0.1;
            # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ {
            root/users/yangshuo/work/index.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;
 #}
    }

Restart and then visit it.

Add index.

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.