【问题标题】:Browser downloads source code from server when I access my site through https当我通过 https 访问我的网站时,浏览器会从服务器下载源代码
【发布时间】:2013-03-18 21:41:05
【问题描述】:

我在 ubuntu 计算机上运行 nginx。我刚刚创建了一个 ssl 证书并在 available-sites 文件中进行了如下配置:

server {

        listen 443;
        server_name localhost;
        root /var/www;
        index index.php;
        ssl on;
        ssl_certificate /etc/nginx/conf.d/server.crt;
        ssl_certificate_key /etc/nginx/conf.d/server.key;
}

当我转到 https://[address] 时,我的浏览器会下载网站的源代码,但它不会在浏览器中显示任何内容。如果我在配置文件中注释掉 root 行,浏览器会显示“欢迎使用 Nginx”页面。

当我从 https 访问时,如何让浏览器显示我的网站?

【问题讨论】:

    标签: ubuntu ssl nginx


    【解决方案1】:

    如果您设置了 nginx 和 php-fpm,则需要让 nginx 将对任何以 .php 结尾的文件的请求转发到 php 处理器。

    具体来说,您似乎在server 块内缺少这个location 块:

    location ~ \.php$ {
        include /path/to/your/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /path/to/your/web/root$fastcgi_script_name;
    }
    

    【讨论】:

      猜你喜欢
      • 2013-02-14
      • 2010-10-19
      • 2020-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-18
      • 2013-09-28
      • 2014-10-09
      相关资源
      最近更新 更多