nginx pseudo-static problem
PHP中文网
PHP中文网 2017-05-16 17:15:30
0
1
443

How to configure nginx so that when www.x.cn/a is opened, www.x.cn/a.html is accessed

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
某草草
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
  }
}

The core is the use of the try_files command, you can refer to the NGINX documentation

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!