<分区>
我正在尝试服务 CachetHQ在 nginx + php-fpm 中的特定位置。文档将此作为在 status.example.com
中提供的示例(有效):
server {
listen 80;
server_name status.example.com;
root /var/www/Cachet/public;
index index.php;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_keep_conn on;
}
}
但是,我不想在 status.example.com
中提供服务,而是希望在 example.com/status
中提供服务。
我原以为这会起作用,但从 error.log 中我看到它正在尝试 /etc/nginx/htmlindex.php
,但它应该是 /mnt/data/site/www-cachet/public/index.php
:
location /status/ {
index index.php;
root /mnt/data/site/www-cachet/public;
try_files $uri index.php$is_args$args;
location ~ ^/status/.+\.php$ {
root /mnt/data/site/www-cachet/public;
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_keep_conn on;
}
}