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

浏览器无法解析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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 为什么我版本升级之后运行速度变慢5倍??
    • ¥15 如何在gazebo中加载机械臂和机械手
    • ¥15 纯运放实现隔离采样方案设计
    • ¥20 easyconnect无法连接后缀带.com的网站,一直显示找不到服务器ip地址,但是带有数字的网站又是可以连接上的,如何解决
    • ¥15 电脑开机过商标后就直接这样,求解各位
    • ¥15 mysql , 用自己创建的本地主机和用户名 登录不上
    • ¥15 关于#web项目#的问题,请各位专家解答!
    • ¥15 vmtools环境不正常
    • ¥15 请问如何在Ubuntu系统中安装使用microsoft R open?
    • ¥15 jupyter notebook