Sto provando a servire CachetHQ in nginx + php-fpm in una posizione specifica. Il docs dà questo come esempio, che serve a status.example.com
(che funziona):Nginx per ospitare l'app in un'altra posizione
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;
}
}
Tuttavia, invece di servire in status.example.com
, vorrei servire in example.com/status
.
mi aspettavo che questo dovrebbe funzionare, ma da error.log vedo che sta cercando /etc/nginx/htmlindex.php
, ma dovrebbe essere /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;
}
}
La priorità non è giusta. La prima risposta è 'location /' – zywj
@ZYWJ bene 'location /' non dovrebbe essere un problema dato che non dovrei trovarmi in '/ status' – rodorgas
@rodorgas, la mia risposta funziona per te, giusto? – cnst