Ubuntu 当我通过https访问我的站点时,浏览器从服务器下载源代码
我在ubuntu电脑上运行nginx。我刚刚创建了一个ssl证书,并在可用站点文件中对其进行了如下配置: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
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;
}