Heim  >  Fragen und Antworten  >  Hauptteil

Pseudostatisches Nginx-Problem

So konfigurieren Sie Nginx so, dass beim Öffnen von www.x.cn/a auf www.x.cn/a.html zugegriffen wird

PHP中文网PHP中文网2713 Tage vor447

Antworte allen(1)Ich werde antworten

  • 某草草

    某草草2017-05-16 17:17:30

    server {
      index index.html index.php;
      location / {
        try_files $uri $uri/ $uri.html $uri.php?$query_string;
      }
      location ~ \.php$ {
        try_files $uri =404;
        # add fastcgi_pass line here, depending if you use socket or port
      }
    }

    核心是 try_files 指令的使用, 你可以参考NGINX的文档

    Antwort
    0
  • StornierenAntwort