当我只使用http时,我能够成功地访问php文件,但是现在我已经安装了https,我不能再访问这个页面了,而是下载脚本。
这是我的文件,在/etc/nginx/sites avaliable/默认值
server{
root /media/world/web/dev;
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost web.dev;
location / {
try_files $uri $uri/ =404;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/web.dev/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/web.dev/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}我所遵循的教程
https://certbot.eff.org/lets-encrypt/ubuntubionic-nginx (Nginx-ubuntu18.04)
https正在工作,如果我执行index.html,它就能正常工作。
有人能指点我如何调试这个吗?
发布于 2019-04-08 01:37:11
您的/etc/nginx/sites-avaliable/default文件不包含php配置,或者像DigitalOcean链接中提到的那样,在/etc/nginx/sites-avaliable/中有另一个文件吗?如果不是,您可能在配置SSL时意外地删除了它。在Certbot配置文件之前尝试添加以下内容:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}发布于 2019-09-18 06:49:55
Nginx不像其他web服务器一样包含本地PHP处理。因此,在安装PHP之前,您需要使用以下命令安装php-fpm包:
sudo apt install php-fpm然后,在配置文件上设置其余的配置:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}https://askubuntu.com/questions/1131909
复制相似问题