时而滑稽之丶 2020-01-30 14:56 采纳率: 0%
浏览 490

浏览器无法解析Ubuntu服务器中的php文件,只能自动下载

如题,环境Ubuntu16.04+nginx+php7.0
网站www.zxc233.top。
当访问www.zxc233.top/index.html时,一切正常,
但当访问www.zxc233.top/_h5ai/public/index.php时,即不可浏览和解析该文件,只能下载到本地,求解!请各位大佬帮我看一下吧,谢谢了!!!
下面是sites-available中的default文件

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        if (-f $request_filename/index.html){
          rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
          rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
          rewrite (.*) /index.php;
        }
        root /var/www/html;
        index index.php;
    }
    location ~ \.php$ {
        root           /var/www/html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #   include snippets/fastcgi-php.conf;
    #
    #   # With php7.0-cgi alone:
    #   fastcgi_pass 127.0.0.1:9000;
    #   # With php7.0-fpm:
    #   fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    #}

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


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

  • 写回答

0条回答 默认 最新

      报告相同问题?

      悬赏问题

      • ¥15 yolov5双目识别输出坐标代码报错
      • ¥15 这个代码有什么语法错误
      • ¥15 给予STM32按键中断与串口通信
      • ¥15 使用QT实现can通信
      • ¥15 关于sp验证的一些东西,求告知如何解决,
      • ¥20 关于#javascript#的问题:但是我写的只能接码数字和字符,帮我写一个解码JS问题
      • ¥15 prophet运行报错,如何解决?
      • ¥15 用GPU跑pytorch搭建的LSTM的时候出现了奇怪的报错
      • ¥20 前端数据是从session等作用域拿到的,如何取值继续传递后端呢
      • ¥15 eclipse无法正常运行