我的服务器让我下载代码而不是运行它

我的服务器让我下载代码而不是运行它

我正在运行 ubuntu 服务器 12.04,但不幸的是我无法让解释器准确运行代码。我正在使用 nginx 加密 lvm,这是 conf.d(主要部分):

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /website;
    index index.php index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
    }

    #location /doc/ {
    #   alias /usr/share/doc/;
    #   autoindex on;
    #   allow 127.0.0.1;
    #   allow ::1;
    #   deny all;
    #}

    # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
    #location /RequestDenied {
    #   proxy_pass http://127.0.0.1:8080;    
    #}

    #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 /usr/share/nginx/html;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #   fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #
    #   # With php5-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
    #   # With php5-fpm:
    #   fastcgi_pass unix:/var/run/php5-fpm.sock;
    #   fastcgi_index index.php;
    #   include fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}
}

另一件让我颇感疑惑的事情是,我究竟如何才能检查我目前安装了哪些“模块”?例如,我想运行 sqli、php 和 jquery,但这真的很麻烦,因为我总是怀疑我安装了什么和没有安装什么,以及我应该如何继续安装我需要的东西……

答案1

您没有 php 处理程序。

做 :

apt-get install php5-fpm 

然后将其添加到您的虚拟主机:

location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini

                # With php5-cgi alone:
                #fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }

相关内容