0

我正在关注本教程https://www.digitalocean.com/community/articles/how-to-configure-nginx-as-a-front-end-proxy-for-apache来设置 nginx 处理静态内容和所有 php 文件都由 apache 在新的 ubuntu 盒子上处理。一切顺利,我在服务器上安装了一个 php 脚本。

但是,它不加载任何 .html 文件。所有 .php 文件正在加载并且工作正常。每当浏览器请求 html 文件时,浏览器都会重定向回 index.php(尽管以 .html 结尾的 url 仍保留在地址栏中)

我已经仔细检查过,我已经按照教程完成了所有工作。什么可能会阻止 nginx 加载 html 文件?

这是我的 nginx 配置:

server {
    listen   80; 

    root /var/www/; 
    index index.php index.html index.htm;

    server_name example.com; 

    location / {
    try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {

    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:8080;

     }

     location ~ /\.ht {
            deny all;
    }

以下是 nginx 错误日志:

http://d.pr/f/voxs

4

0 回答 0