我在 nginx 中有更多我的 magento 存储这样的配置:
server {
listen 80;
server_name domain.com;
root /www-data/domain.com/www;
access_log /www-data/domain.com/logs/nginx.access.log main;
error_log /www-data/domain.com/logs/nginx.error_log info;
index index.php;
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
}
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location ~* "^.+\.(jpg|jpeg|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf)$" {
expires max;
add_header Cache-Control public;
access_log off;
}
location /. {
return 404;
}
location @handler {
rewrite / /index.php;
}
location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ {
if (!-e $request_filename) { rewrite / /index.php last; }
fastcgi_read_timeout 60;
expires off;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
我需要为管理区域创建新的位置部分,它运行在标准 index.php 上,但超时时间很长。
所以我需要像 /admin/* 或 /index.php/admin/* 这样的路径有超时 600
任何人都可以帮助我并获取此类位置的样本吗?
据我了解,它一定是这样的:
# Magento Admin
location ^~ /index.php/backoffice/ {
if (!-e $request_filename) { rewrite / /index.php last; }
fastcgi_read_timeout 600;
expires off;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
但是这个配置让我Access denied,所以我认为fastcgi_param SCRIPT_FILENAME必须具有其他值。