我试图让我的 index.php 来处理 http 路由,所以让我的应用程序变得安静。
我在 nginx.cong 中使用了 try_files 指令,但没有用,我点击 /blablabla 并没有通过 index.php 而是抛出 404。这是我当前的 nginx.conf
<pre>
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
location / {
try_files $uri $uri/ /index.php;
}
}
}
</pre>