【发布时间】:2018-04-14 02:43:35
【问题描述】:
我想为我的 laravel 应用展示一些来自 Wordpress 的不那么重要的内容页面。
我已经在我的 laravel 应用程序的public/pages 文件夹中安装了 Wordpress。
然而,我面临的问题是漂亮的链接(laravel.app/pages/sample-page)抛出 404,因为它们是由 laravel 处理的。
我该如何解决这个问题?我假设它必须在 nginx 配置文件上处理。
该站点托管在 Laravel Forge 上,这里是 nginx 配置文件:
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/laravel.app/before/*;
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name .laravel.app;
root /home/forge/laravel.app/public;
# FORGE SSL (DO NOT REMOVE!)
ssl_certificate /etc/nginx/ssl/laravel.app/264952/server.crt;
ssl_certificate_key /etc/nginx/ssl/laravel.app/264952/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'xxx';
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/laravel.app/server/*;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/laravel.app-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/laravel.app/after/*;
提前致谢。
【问题讨论】: