Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 当我通过https访问我的站点时,浏览器从服务器下载源代码_Ubuntu_Ssl_Nginx - Fatal编程技术网

Ubuntu 当我通过https访问我的站点时,浏览器从服务器下载源代码

Ubuntu 当我通过https访问我的站点时,浏览器从服务器下载源代码,ubuntu,ssl,nginx,Ubuntu,Ssl,Nginx,我在ubuntu电脑上运行nginx。我刚刚创建了一个ssl证书,并在可用站点文件中对其进行了如下配置: server { listen 443; server_name localhost; root /var/www; index index.php; ssl on; ssl_certificate /etc/nginx/conf.d/server.crt; ssl_certif

我在ubuntu电脑上运行nginx。我刚刚创建了一个ssl证书,并在可用站点文件中对其进行了如下配置:

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访问我的站点时,如何让浏览器显示我的站点?

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

具体来说,您似乎缺少
服务器中的
位置
块:

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;
}