Estou configurando um servidor como servidor de monitoramento Nagios e estou com um problema.
Se eu for ao url nagios.myserver.com/nagios/ (ou nagios.myserver.com/nagios/index.php), o servidor tentará redirecionar para /opt/nagios/share/s/index.php
A pasta correta é: / opt / nagios / share /
Eu não tenho ideia de onde esse / s / está vindo.
Registro de erros:
2011/11/06 00:16:28 [error] 1818#0: *13 open() "/opt/nagios/share/s/index.php" failed (2: No such file or directory), client: 75.xxxxxxxxxxxxxx, server: nagios.myserver.com, request: "GET /nagios/ HTTP/1.1", host: "nagios.myserver.com"
meu arquivo /etc/nginx/sites-enabled/nagios.myserver.com.conf:
server {
server_name nagios.myserver.com;
access_log /var/log/nginx/nagios.myserver.com.access.log;
error_log /var/log/nginx/nagios.myserver.com.error.log;
auth_basic "Restricted Nagios Area!";
auth_basic_user_file /opt/nagios/etc/htpasswd.users;
root /var/www/nagios.myserver.com;
index index.php index.html;
location / {
try_files $uri $uri/ index.php;
auth_basic "Restricted";
auth_basic_user_file /opt/nagios/etc/htpasswd.users;
}
location /nagios {
alias /opt/nagios/share/;
}
location ~ ^/nagios/(.*\.php)$ {
alias /opt/nagios/share/$1;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~ \.cgi$ {
root /opt/nagios/sbin/;
rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
conteúdo do fastcgi.conf:
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (-f $request_filename) {
fastcgi_pass unix:/var/run/www/php.sock;
}
}
fastcgi_params:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
Depuração:
2011/11/06 01:30:29 [debug] 5226#0: *1 open index "/opt/nagios/share/index.php"
2011/11/06 01:30:29 [debug] 5226#0: *1 internal redirect: "/nagios/index.php?"
2011/11/06 01:30:29 [debug] 5226#0: *1 generic phase: 1
2011/11/06 01:30:29 [debug] 5226#0: *1 test location: "/"
2011/11/06 01:30:29 [debug] 5226#0: *1 test location: "nagios"
2011/11/06 01:30:29 [debug] 5226#0: *1 test location: ~ "^/nagios/(.*\.php)$"
2011/11/06 01:30:29 [debug] 5226#0: *1 test location: ~ "\.php$"
2011/11/06 01:30:29 [debug] 5226#0: *1 using configuration "\.php$"
2011/11/06 01:30:29 [debug] 5226#0: *1 http cl:-1 max:1048576
2011/11/06 01:30:29 [debug] 5226#0: *1 generic phase: 3
2011/11/06 01:30:29 [debug] 5226#0: *1 http script complex value
2011/11/06 01:30:29 [debug] 5226#0: *1 http script copy: "/opt/nagios/share/"
2011/11/06 01:30:29 [debug] 5226#0: *1 http script capture: ""
2011/11/06 01:30:29 [debug] 5226#0: *1 http script copy: "/opt/nagios/share/"
2011/11/06 01:30:29 [debug] 5226#0: *1 http script capture: ""
2011/11/06 01:30:29 [debug] 5226#0: *1 http script var: "/opt/nagios/share/s/index.php"
2011/11/06 01:30:29 [debug] 5226#0: *1 http script copy: ""
2011/11/06 01:30:29 [debug] 5226#0: *1 http script file op 00000000 "/opt/nagios/share/s/index.php"
2011/11/06 01:30:29 [debug] 5226#0: *1 http script file op false
2011/11/06 01:30:29 [debug] 5226#0: *1 http script if
2011/11/06 01:30:29 [debug] 5226#0: *1 http script if: false
2011/11/06 01:30:29 [debug] 5226#0: *1 post rewrite phase: 4
2011/11/06 01:30:29 [debug] 5226#0: *1 generic phase: 5
2011/11/06 01:30:29 [debug] 5226#0: *1 generic phase: 6
2011/11/06 01:30:29 [debug] 5226#0: *1 generic phase: 7
2011/11/06 01:30:29 [debug] 5226#0: *1 access phase: 8
2011/11/06 01:30:29 [debug] 5226#0: *1 access phase: 9
Guardei alguns dos depuração, pois acho que essa parte deve ajudar, embora eu ainda não consiga descobrir.
Alguma idéia?
Sou muito novo no NginX.
Obrigado.